不用转职,列优先取矩阵元素
import java.util.HashMap;import java.util.Map;public class TT {private static final String TIANGAN[][] = { { "文昌", "巳", "午", "申" },{ "武状元", "12", "s", "4" }, { "天乙贵人", "1", "4", "45" }};private final static String tg[] = { "甲", "乙", "丙", "丁", "戊", "已", "庚","辛", "壬", "癸" };private static final Map<String, Integer> map ;static{map=new HashMap<String, Integer>();for (int i = 1; i < tg.length+1; i++) {map.put( tg[i-1],i);}}public static void main(String[] args) {test();}public static void test() {String one = "甲";String two[] = { "甲", "巳" };for (String s : two) {for (int i = 1; i < TIANGAN[0].length; i++) {for (int j = 0; j < TIANGAN.length; j++) {}}}}public static int changeToNumber(String s){return map.get(s);}}?