getMingGong method
Implementation
String getMingGong() {
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 = MONTH_ZHI.length; i < j; i++) {
if (timeZhi == MONTH_ZHI[i]) {
timeZhiIndex = i;
break;
}
}
int offset = monthZhiIndex + timeZhiIndex;
offset = (offset >= 14 ? 26 : 14) - offset;
int ganIndex = (_lunar.getYearGanIndexExact() + 1) * 2 + offset;
while (ganIndex > 10) {
ganIndex -= 10;
}
return LunarUtil.GAN[ganIndex] + MONTH_ZHI[offset];
}