code: public static int[] calElement(int year, int month, int day) {
          int[] nongDate = new int[3];
          int i, temp = 0, leap;
          // Date baseDate = new Date(0, 0, 31);
          Date baseDate = new GregorianCalendar(1900, 0, 31).getTime();
          // Date objDate = new Date(y - 1900, m - 1, d);
          Date objDate = new GregorianCalendar(year, month - 1, day).getTime();
          // 此处必须四舍五入
          int offset = Math.round((objDate.getTime() - baseDate.getTime()) / 86400000F);
  
          for (i = 1900; i < 2050 && offset > 0; i++) {
              temp = lYearDays(i);
              offset -= temp;
          }
          if (offset < 0) {
              offset += temp;
              i--;
          }
          nongDate[0] = i;
          leap = leapMonth(i); // 闰哪个月
  
          for (i = 1; i < 13 && offset > 0; i++) {
              // 闰月
              if (leap > 0 && i == (leap + 1)) {
                  --i;
                  temp = leapDays(nongDate[0]);
              } else {
                  temp = monthDays(nongDate[0], i);
              }
              offset -= temp;
          }
  
          if (offset < 0) {
              offset += temp;
              --i;
          }
          nongDate[1] = i;
          nongDate[2] = offset + 1;
          return nongDate;
      }
docs: 计算指定年月日对应的农历年月日
  
  @param year  指定年
  @param month 指定月
  @param day   指定日
  @return 农历的年月日数组，数组第一个为年，第二个为月，第三个为日