PackedLocalTime { public static int withHour(int hour, int packedTime) { if (PackedLocalTime.getHour(packedTime) == hour) { return packedTime; } ChronoField.HOUR_OF_DAY.checkValidValue(hour); return create( hour, PackedLocalTime.getMinute(packedTime), PackedLocalTime.getSecond(packedTime), PackedLocalTime.getMilliseconds(packedTime)); }  static byte getHour(int time); static int of(int hour, int minute); static int of(int hour, int minute, int second); static int of(int hour, int minute, int second, int millis); static int truncatedTo(TemporalUnit unit, int packedTime); static int plusHours(int hoursToAdd, int packedTime); static int plusMinutes(int minutesToAdd, int packedTime); static int plusSeconds(int secondsToAdd, int packedTime); static int plusMilliseconds(int msToAdd, int packedTime); static int minusHours(int hoursToSubtract, int packedTime); static int minusMinutes(int minutesToSubtract, int packedTime); static int minusSeconds(int secondsToSubtract, int packedTime); static int minusMilliseconds(int millisToSubtract, int packedTime); static int withHour(int hour, int packedTime); static int withMinute(int minute, int packedTime); static int withSecond(int second, int packedTime); static int withMillisecond(int milliseconds, int packedTime); static char getMillisecondOfMinute(int time); static int getNano(int time); static int getMilliseconds(int time); static long toNanoOfDay(int time); static LocalTime asLocalTime(int time); static byte getMinute(int time); static int pack(LocalTime time); static byte getSecond(int packedLocalTime); static int getMinuteOfDay(int packedLocalTime); static int getSecondOfDay(int packedLocalTime); static int getMillisecondOfDay(int packedLocalTime); static String toShortTimeString(int time); static boolean isMidnight(int packedTime); static boolean isNoon(int packedTime); static boolean isAfter(int packedTime, int otherPackedTime); static boolean isOnOrAfter(int packedTime, int otherPackedTime); static boolean isBefore(int packedTime, int otherPackedTime); static boolean isOnOrBefore(int packedTime, int otherPackedTime); static boolean isEqualTo(int packedTime, int otherPackedTime); static boolean AM(int packedTime); static boolean PM(int packedTime); static int hoursUntil(int packedTimeEnd, int packedTimeStart); static int minutesUntil(int packedTimeEnd, int packedTimeStart); static int secondsUntil(int packedTimeEnd, int packedTimeStart);  }
@Test public void testWithHour() { LocalTime localTime = LocalTime.of(5, 11, 33, 811 * 1_000_000); LocalTime localTime2 = localTime.withHour(7); int packedTime = pack(localTime); int packedTime2 = withHour(7, packedTime); assertTimeEquals(localTime2, packedTime2); }