class PackedLocalTime {

  public static int plusMinutes(int minutesToAdd, int packedTime) {
    if (minutesToAdd == 0) {
      return packedTime;
    }
    int hour = PackedLocalTime.getHour(packedTime);
    int minute = PackedLocalTime.getMinute(packedTime);
    int second = PackedLocalTime.getSecond(packedTime);
    int milli = PackedLocalTime.getMilliseconds(packedTime);

    int mofd = hour * MINUTES_PER_HOUR + minute;

    int newMofd = ((minutesToAdd % MINUTES_PER_DAY) + mofd + MINUTES_PER_DAY) % MINUTES_PER_DAY;
    if (mofd == newMofd) {
      return packedTime;
    }
    int newHour = newMofd / MINUTES_PER_HOUR;
    int newMinute = newMofd % MINUTES_PER_HOUR;
    return create(newHour, newMinute, second, milli);
  }

}