package cn.gp.test;
import java.io.UnsupportedEncodingException;
import java.util.Random;
public class ChineseTest {
public static void main(String[] args) throws UnsupportedEncodingException {
for(int i = 0 ;i<100;i++){
String str = null;
int hightPos, 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] = (new Integer(hightPos).byteValue());
b[1] = (new Integer(lowPos).byteValue());
str = new String(b, "GBk");//转成中文
System.out.print("--------------------"+i);
System.out.println(str);
}
}
}
import java.io.UnsupportedEncodingException;
import java.util.Random;
public class ChineseTest {
public static void main(String[] args) throws UnsupportedEncodingException {
for(int i = 0 ;i<100;i++){
String str = null;
int hightPos, 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] = (new Integer(hightPos).byteValue());
b[1] = (new Integer(lowPos).byteValue());
str = new String(b, "GBk");//转成中文
System.out.print("--------------------"+i);
System.out.println(str);
}
}
}
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29753604/viewspace-1371303/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29753604/viewspace-1371303/