谁有关于二十四节气的算法,最后用java实现的代码?
导入Java . util . *;/* *此处规则/附录/f2.htm超过字数。我来缩进删除*/public类节气{ public static void main(string[]s)throws exception {节气st =新节气();if(s . length = = 3){ system . out . println(ST . getsoralterm(integer . parse int(s[0])),Integer.parseInt(s[1]),integer . parse int(s[2]));} system . out . println(ST . getsoralterm(2009,1,5));system . out . println(ST . getsoralterm(2009,1,20));system . out . println(ST . getsoralterm(2009,1,23));system . out . println(ST . getsoralterm(2009,2,18));}最终静态long[] STermInfo = new long[] { 0,21208,42467,63836,85337,107014,128867,150921,173149,195558private static final string[]solar $ TERM = new string[]{ "小寒"、"严寒"、"立春"、"下雨"、"惊蛰"、"春分"、"清明"、"谷雨"、"长夏"、"小满"、"芒草"、"夏至日" public SolarTerm(){}/**根据日期获取节气的核心方法*/public string getsoralterm(date){ calendar cal = calendar . getinstance();cal.setTime(日期);int y = cal.get(日历。年份);int m = cal.get(日历。月)+1;int d = cal.get(日历。月日);返回getSoralTerm(y,m,d);}/* *核心方法根据日期(Y年,M月,D日)*/public string getsoralterm(int Y,int m,int d) {string节气;if (d == sTerm(y,(m-1)* 2))solarTerms = SolarTerm[(m-1)* 2];else if (d == sTerm(y,(m-1)* 2+1))solarTerms = SolarTerm[(m-1)* 2+1];Else{//这里,非节气= " ";}返回solarTerms}/= = = = Y年第n个节气是几天(从0小寒开始)private int stern (int y,int n){ calendar cal = calendar . getinstance();cal.set(1900,0,6,2,5,0);long temp = cal.getTime()。getTime();cal.setTime(新日期((long))((31556925974.7 *(y-1900)+STermInfo[n]* 60000 l)+temp));返回cal.get(日历。月日);}}