本帖最后由 chouwayメ 于 2013-5-25 15:43 编辑
张龙欢 发表于 2013-5-25 14:57
是按照上面的格式打印出来,还有String Prevevce是公司规定好了的!
哦 原来这样 就是打印.这样应该就可以了
- import java.io.*;
- import java.util.*;
- import java.util.Map.Entry;
- public class Test1
- {
- public static void main(String[] args) throws Exception
- {
- Map<Long,String> ms=new HashMap<Long,String>( );
- ms.put(21401000000l,"省级编码");
- ms.put(21401030000l,"市级编码");
- ms.put(21401010400l,"市级编码");
- ms.put(21401010000l,"区县编码");
- ms.put(21401020000l,"区县编码");
- ms.put(21401010100l,"区县编码");
- ms.put(21401010200l,"区县编码");
- ms.put(21400000000l,"科所编码");
- ms.put(21401010300l,"科所编码");
- ms.put(21401040000l,"科所编码");
- ms.put(21402000000l,"科所编码");
- ms.put(21401010500l,"科所编码");
- String[] str=new String[]{"省级编码","市级编码","区县编码","科所编码"};
-
- for(int i=0;i<4;i++)
- {
- for(Entry<Long, String> entry:ms.entrySet())
- {
- Long lon = entry.getKey();
- String value = entry.getValue();
- if(value==str[i])
- System.out.print(value+":"+lon);
- };
- System.out.println();
- }
- }
- }
复制代码 |