question: public static double calculateJulianDate ( GregorianCalendar cal ) { int year = cal . get ( Calendar . YEAR ) ; int month = cal . get ( Calendar . MONTH ) ; int day = cal . get ( Calendar . DAY_OF_MONTH ) ; month ++ ; if ( ( month == 1 ) || ( month == 2 ) ) { year -= 1 ; month += 12 ; } int A = year / 100 ; int B = ( int ) ( 2 - A + ( A / 4 ) ) ; int C = ( int ) ( 365.25 * ( float ) year ) ; int D = ( int ) ( 30.6001 * ( float ) ( month + 1 ) ) ; double julianDate = ( double ) ( B + C + D + day ) + 1720994.5 ; return julianDate ; }
target:  Given a date from a gregorian calendar, give back a julian date. From Duffett-Smith, chapter 4.