DateTimeUtils { public static Date mjdFloatDateToUtc(float mjd) { final int days = (int) mjd; final double secondsFraction = (mjd - days) * 86400.0; final int seconds = (int) secondsFraction; final int microseconds = (int) ((secondsFraction - seconds) * 1.0e6); return cfiDateToUtc(days, seconds, microseconds); }  static Calendar getUtcCalendar(); static Date cfiDateToUtc(int days, long seconds, long microseconds); static Date cfiDateToUtc(CompoundData compoundData); static Date mjdFloatDateToUtc(float mjd); static String toVariableHeaderFormat(Date date); static String toFixedHeaderFormat(Date date); static Date fromFixedHeaderFormat(String dateString); static String toFileNameFormat(Date date);  }
@Test public void testMjdFloatDateToUtc() { Date date = DateTimeUtils.mjdFloatDateToUtc(0.0f); assertEquals("Sat Jan 01 01:00:00 CET 2000", date.toString()); date = DateTimeUtils.mjdFloatDateToUtc(1.0f); assertEquals("Sun Jan 02 01:00:00 CET 2000", date.toString()); date = DateTimeUtils.mjdFloatDateToUtc(1.0f + 10.f / 86400); long timeWithoutMillis = date.getTime(); assertEquals("Sun Jan 02 01:00:10 CET 2000", date.toString()); date = DateTimeUtils.mjdFloatDateToUtc(1.0f + 10.1f / 86400); assertEquals("Sun Jan 02 01:00:10 CET 2000", date.toString()); assertEquals(timeWithoutMillis + 103, date.getTime()); }