public static int[] getDate(final double JULIAN_DAY) throws Exception {
        if (JULIAN_DAY < 2299160.0 && JULIAN_DAY >= 2299150.0) {
            throw new Exception("invalid julian day " + JULIAN_DAY + ". This date does not exist.");
        }

        // The conversion formulas are from Meeus,
        // Chapter 7.
        double Z = Math.floor(JULIAN_DAY + 0.5);
        double F = JULIAN_DAY + 0.5 - Z;
        double A = Z;
        if (Z >= 2299161D) {
            int a = (int) ((Z - 1867216.25) / 36524.25);
            A += 1 + a - a / 4;
        }
        double B = A + 1524;
        int    C = (int) ((B - 122.1) / 365.25);
        int    D = (int) (C * 365.25);
        int    E = (int) ((B - D) / 30.6001);

        double exactDay = F + B - D - (int) (30.6001 * E);
        int    day      = (int) exactDay;
        int    month    = (E < 14) ? E - 1 : E - 13;
        int    year     = C - 4715;
        if (month > 2) year--;
        double h = ((exactDay - day) * SECONDS_PER_DAY) / 3600.0;

        int    hour   = (int) h;
        double m      = (h - hour) * 60.0;
        int    minute = (int) m;
        int    second = (int) ((m - minute) * 60.0);

        return new int[] { year, month, day, hour, minute, second };
    }
public static int [ ] getDate ( final double JULIAN_DAY ) throws Exception { if ( JULIAN_DAY < 2299160.0 && JULIAN_DAY >= 2299150.0 ) { throw new Exception ( "invalid julian day " + JULIAN_DAY + ". This date does not exist." ) ; } double Z = Math . floor ( JULIAN_DAY + 0.5 ) ; double F = JULIAN_DAY + 0.5 - Z ; double A = Z ; if ( Z >= 2299161D ) { int a = ( int ) ( ( Z - 1867216.25 ) / 36524.25 ) ; A += 1 + a - a / 4 ; } double B = A + 1524 ; int C = ( int ) ( ( B - 122.1 ) / 365.25 ) ; int D = ( int ) ( C * 365.25 ) ; int E = ( int ) ( ( B - D ) / 30.6001 ) ; double exactDay = F + B - D - ( int ) ( 30.6001 * E ) ; int day = ( int ) exactDay ; int month = ( E < 14 ) ? E - 1 : E - 13 ; int year = C - 4715 ; if ( month > 2 ) year -- ; double h = ( ( exactDay - day ) * SECONDS_PER_DAY ) / 3600.0 ; int hour = ( int ) h ; double m = ( h - hour ) * 60.0 ; int minute = ( int ) m ; int second = ( int ) ( ( m - minute ) * 60.0 ) ; return new int [ ] { year , month , day , hour , minute , second } ; }
Transforms a Julian day (rise/set/transit fields) to a common date.

@param JULIAN_DAY The Julian day.

@return A set of integers: year, month, day, hour, minute, second.

@throws Exception If the input date does not exists.