code: private static int[] jdToGregorian(double jd) {
         double JULIAN_EPOCH = 1721425.5;
         double wjd, depoch, quadricent, dqc, cent, dcent, quad, dquad, yindex, yearday, leapadj;
         int year, month, day;
         
         wjd = Math.floor(jd - 0.5) + 0.5;
         depoch = wjd - JULIAN_EPOCH;
         quadricent = Math.floor(depoch / 146097);
         dqc = depoch % 146097;
         cent = Math.floor(dqc / 36524);
         dcent = dqc % 36524;
         quad = Math.floor(dcent / 1461);
         dquad = dcent % 1461;
         yindex = Math.floor(dquad / 365);
         year = (int)((quadricent * 400) + (cent * 100) + (quad * 4) + yindex);
         
         if (!((cent == 4) || (yindex == 4))) {
            year++;
         }
         
         yearday = wjd - gregorianToJD(year, 1, 1);
         leapadj = ((wjd < gregorianToJD(year, 3, 1)) ? 0
               :
               (isGregorianLeap(year) ? 1 : 2)
               );
         
         month = (int)Math.floor((((yearday + leapadj) * 12) + 373) / 367);
         day = (int)(wjd - gregorianToJD(year, month, 1)) + 1;
  
         int[] julianDate = new int[3];
         
         julianDate[0] = year;
         julianDate[1] = month;
         julianDate[2] = day;
         
         return julianDate;
      }
docs: /*
  The following function is not needed for basic calendar functioning.
  This routine converts a julian day (jd) to the corresponding date in Gregorian calendar"
  @param jd The Julian date in Julian Calendar which is to be converted to Indian date"