Java的身份证号码工具类

上传人:飞*** 文档编号:4679320 上传时间:2017-08-22 格式:DOCX 页数:20 大小:32.09KB
返回 下载 相关 举报
Java的身份证号码工具类_第1页
第1页 / 共20页
Java的身份证号码工具类_第2页
第2页 / 共20页
Java的身份证号码工具类_第3页
第3页 / 共20页
Java的身份证号码工具类_第4页
第4页 / 共20页
Java的身份证号码工具类_第5页
第5页 / 共20页
点击查看更多>>
资源描述

《Java的身份证号码工具类》由会员分享,可在线阅读,更多相关《Java的身份证号码工具类(20页珍藏版)》请在金锄头文库上搜索。

1、1. /* 2. * Copyright (C) 2009-2010 Yichuan, Fuchun All rights reserved. 3. * Licensed to the Apache Software Foundation (ASF) under one or more 4. * contributor license agreements. See the NOTICE file distributed with 5. * this work for additional information regarding copyright ownership.6. * The A

2、SF licenses this file to You under the Apache License, Version2.0 7. * (the License); you may not use this file except in compliance with 8. * the License. You may obtain a copy of the License at 9. * http:/www.apache.org/licenses/LICENSE-2.0 10. * Unless required by applicable law or agreed to in w

3、riting, software11. * distributed under the License is distributed on an AS IS BASIS, 12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13. * See the License for the specific language governing permissions and14. * limitations under the License. 15. * (#) IdcardUtils.jav

4、a Date: 2010-06-17 16. */ 17. package my.tools; 18. 19. import java.text.ParseException; 20. import java.text.SimpleDateFormat; 21. import java.util.Calendar; 22. import java.util.Date; 23. import java.util.HashMap; 24. import java.util.Map; 25. 26. import mons.lang.StringUtils; 27. 28. /* 29. * 身份证

5、工具类 30. * 31. * author June 32. * version 1.0, 2010-06-17 33. */ 34. public class IdcardUtils extends StringUtils 35. 36. /* 中国公民身份证号码最小长度。 */ 37. public static final int CHINA_ID_MIN_LENGTH = 15; 38. 39. /* 中国公民身份证号码最大长度。 */ 40. public static final int CHINA_ID_MAX_LENGTH = 18; 41. 42. /* 省、直辖市代码表

6、*/ 43. public static final String cityCode = 44. 11, 12, 13, 14, 15, 21, 22, 23, 31, 32, 33, 34, 35, 36, 37, 41, 45. 42, 43, 44, 45, 46, 50, 51, 52, 53, 54, 61, 62, 63, 64, 65, 71, 46. 81, 82, 91 47. ; 48. 49. /* 每位加权因子 */ 50. public static final int power = 51. 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9,

7、10, 5, 8, 4, 2 52. ; 53. 54. /* 第 18 位校检码 */ 55. public static final String verifyCode = 56. 1, 0, X, 9, 8, 7, 6, 5, 4, 3, 2 57. ; 58. /* 最低年限 */ 59. public static final int MIN = 1930; 60. public static Map cityCodes = new HashMap(); 61. /* 台湾身份首字母对应数字 */ 62. public static Map twFirstCode = new Has

8、hMap(); 63. /* 香港身份首字母对应数字 */ 64. public static Map hkFirstCode = new HashMap(); 65. static 66. cityCodes.put(11, 北京); 67. cityCodes.put(12, 天津); 68. cityCodes.put(13, 河北); 69. cityCodes.put(14, 山西); 70. cityCodes.put(15, 内蒙古); 71. cityCodes.put(21, 辽宁); 72. cityCodes.put(22, 吉林); 73. cityCodes.put(

9、23, 黑龙江); 74. cityCodes.put(31, 上海); 75. cityCodes.put(32, 江苏); 76. cityCodes.put(33, 浙江); 77. cityCodes.put(34, 安徽); 78. cityCodes.put(35, 福建); 79. cityCodes.put(36, 江西); 80. cityCodes.put(37, 山东); 81. cityCodes.put(41, 河南); 82. cityCodes.put(42, 湖北); 83. cityCodes.put(43, 湖南); 84. cityCodes.put(44

10、, 广东); 85. cityCodes.put(45, 广西); 86. cityCodes.put(46, 海南); 87. cityCodes.put(50, 重庆); 88. cityCodes.put(51, 四川); 89. cityCodes.put(52, 贵州); 90. cityCodes.put(53, 云南); 91. cityCodes.put(54, 西藏); 92. cityCodes.put(61, 陕西); 93. cityCodes.put(62, 甘肃); 94. cityCodes.put(63, 青海); 95. cityCodes.put(64, 宁

11、夏); 96. cityCodes.put(65, 新疆); 97. cityCodes.put(71, 台湾); 98. cityCodes.put(81, 香港); 99. cityCodes.put(82, 澳门); 100. cityCodes.put(91, 国外); 101. twFirstCode.put(A, 10); 102. twFirstCode.put(B, 11); 103. twFirstCode.put(C, 12); 104. twFirstCode.put(D, 13); 105. twFirstCode.put(E, 14); 106. twFirstCod

12、e.put(F, 15); 107. twFirstCode.put(G, 16); 108. twFirstCode.put(H, 17); 109. twFirstCode.put(J, 18); 110. twFirstCode.put(K, 19); 111. twFirstCode.put(L, 20); 112. twFirstCode.put(M, 21); 113. twFirstCode.put(N, 22); 114. twFirstCode.put(P, 23); 115. twFirstCode.put(Q, 24); 116. twFirstCode.put(R, 25); 117. twFirstCode.put(S, 26); 118. twFirstCode.put(T, 27); 119. twFirstCode.put(U, 28); 120. twFirstCode.put(V, 29); 121. twFirstCode.put(X, 30); 122. twFirstCode.put(Y, 31); 123. twFirstCode.put(W, 32); 124. twFirstCode.put(Z, 33); 125. twFirstCode.put(I, 34); 126. twFirstCode.put

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 研究报告 > 综合/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号