getShenGong method

String getShenGong()

Implementation

String getShenGong() {
  int monthZhiIndex = 0;
  int timeZhiIndex = 0;
  String monthZhi = getMonthZhi();
  String timeZhi = getTimeZhi();
  for (int i = 0, j = MONTH_ZHI.length; i < j; i++) {
    if (monthZhi == MONTH_ZHI[i]) {
      monthZhiIndex = i;
      break;
    }
  }
  for (int i = 0, j = LunarUtil.ZHI.length; i < j; i++) {
    if (timeZhi == LunarUtil.ZHI[i]) {
      timeZhiIndex = i;
      break;
    }
  }
  int offset = monthZhiIndex + timeZhiIndex;
  while (offset > 12) {
    offset -= 12;
  }
  int ganIndex = (_lunar.getYearGanIndexExact() + 1) * 2 + (offset % 12);
  while (ganIndex > 10) {
    ganIndex -= 10;
  }
  return LunarUtil.GAN[ganIndex] + MONTH_ZHI[offset];
}