10038 Java solution