原文:http://blog.csdn.net/u013926110/article/details/44600601

public class CreateCheckCode {

    /**
* 生成随机汉字
* @return
*/
public static char getRandomChar() {
String str = "";
int hightPos;
int lowPos; Random random = new Random(); hightPos = (176 + Math.abs(random.nextInt(39)));
lowPos = (161 + Math.abs(random.nextInt(93))); byte[] b = new byte[2];
b[0] = (Integer.valueOf(hightPos)).byteValue();
b[1] = (Integer.valueOf(lowPos)).byteValue(); try {
str = new String(b, "GB2312");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} return str.charAt(0);
} public static void main(String[] args) { char[] words = new char[4]; for (int i = 0; i<words.length; i++) {
words[i] = getRandomChar();
} System.out.println(words);
} }

http://blog.csdn.net/u013926110/article/details/44600601

最新文章

  1. AspNetPager 多条件分页查询
  2. java 时间操作
  3. php执行root命令
  4. for循环求交集
  5. java web _BBS
  6. BOM(Bill of Material)详解
  7. Docker基础技术:Linux CGroup
  8. iPhone(iOS设备) 无法更新或恢复时, 如何进入恢复模式
  9. HTML5 修改浏览器url而不刷新页面
  10. 2437: [Noi2011]兔兔与蛋蛋 - BZOJ
  11. Binary search for the first element greater than target
  12. hdu-3790最短路径问题
  13. BZOJ 3446: [Usaco2014 Feb]Cow Decathlon( 状压dp )
  14. 你真的了解JAVA中与Webservice相关的规范和实现吗?
  15. mrql初级教程-使用(er)
  16. 讨论MMU
  17. AndroidStudio运行java的main方法
  18. 由PHP实现单向链表引发的对象赋值,对象传参,链表操作引发的一系列问题
  19. 【2017山东day7】养猫
  20. CentOS 7 安装MongoDB详细步骤

热门文章

  1. HDU 4725 The Shortest Path in Nya Graph( 建图 + 最短路 )
  2. 201621123033 《Java程序设计》第7周学习总结
  3. 【bzoj2694】Lcm 莫比乌斯反演+线性筛
  4. Tensorflow 载入数据的三种方式
  5. python登录知乎
  6. 切换cmd的目录
  7. code forces 994C
  8. IEjs 调试、火狐 js 调试
  9. .net 网站首页,本次的项目中用到的一个网站首页中统计网页访问量的工具方法,我觉得它应该在pagebase里面,拿来用一下
  10. 【Tomcat】一台电脑上运行多个tomcat