java自动生成随机中文类
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.Random;
public class ChineseUtils {
private static Random random = null;
private static Random getRandomInstance() {
if (random == null) {
random = new Random(new Date().getTime());
}
return random;
}
public static String getChinese() {
String str = null;
int highPos, lowPos;
Random random = getRandomInstance();
highPos = (176 + Math.abs(random.nextInt(39)));
lowPos = 161 + Math.abs(random.nextInt(93));
byte[] b = new byte[2];
b[0] = (new Integer(highPos)).byteValue();
b[1] = (new Integer(lowPos)).byteValue();
try {
str = new String(b, "GB2312");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return str;
}
public static String getFixedLengthChinese(int length) {
String str = "";
for (int i = length; i > 0; i--) {
str = str + ChineseUtils.getChinese();
}
return str;
}
public static String getRandomLengthChiness(int start, int end) {
String str = "";
int length = new Random().nextInt(end + 1);
if (length < start) {
str = getRandomLengthChiness(start, end);
} else {
for (int i = 0; i < length; i++) {
str = str + getChinese();
}
}
return str;
}
public static String getUserName(int betweenZeroAndSix) {
switch (betweenZeroAndSix) {
case 0:
return "Baul";
case 1:
return "Ebony";
case 2:
return "Tony";
case 3:
return "Charles";
case 4:
return "Pebbles";
case 5:
return "Queen";
default:
return "Kismet";
}
}
public static String getSupplierName(int betweenZeroAndSix) {
switch (betweenZeroAndSix) {
case 0:
return "Ulrika";
case 1:
return "Unity";
case 2:
return "Zelene";
case 3:
return "Shelby";
case 4:
return "Coleman";
case 5:
return "Fielding";
default:
return "Sabrina";
}
}
public static String getHotelName(int betweenZeroAndThirty) {
switch (betweenZeroAndThirty) {
case 0:
return "新中央酒店";
case 1:
return "格兰";
case 2:
return "东亚酒店";
case 3:
return "帝濠酒店";
case 4:
return "财神酒店";
case 5:
return "澳门富华粤海酒店";
case 6:
return "金皇冠中国大酒店";
case 7:
return "金龙酒店";
case 8:
return "英皇娱乐酒店";
case 9:
return "金都酒店";
case 10:
return "君怡酒店";
case 11:
return "东望洋酒店";
case 12:
return "假期酒店";
case 13:
return "澳门假日酒店";
case 14:
return "澳门假日酒店";
case 15:
return "康泰酒店";
case 16:
return "澳门富豪酒店";
case 17:
return "皇家金堡酒店";
case 18:
return "环球酒店";
case 19:
return "莱斯酒店";
case 20:
return "回力酒店";
case 21:
return "金域酒店";
case 22:
return "置地广场酒店";
case 23:
return "葡京酒店";
case 24:
return "英京酒店";
case 25:
return "万事发酒店";
case 26:
return "文华";
case 27:
return "文华东方酒店";
case 28:
return "维景酒店";
case 29:
return "新世纪酒店";
default:
return "利澳酒店";
}
}
public static String getNationality(int betweenZeroAndTen) {
switch (betweenZeroAndTen) {
case 0:
return "Egypt";
case 1:
return "Azerbaijan";
case 2:
return "Ireland";
case 3:
return "Estonia";
case 4:
return "Austria";
case 5:
return "Anguilla";
case 6:
return "Macau";
case 7:
return "Barbados";
case 8:
return "Papua New Guinea";
case 9:
return "Poland";
case 10:
return "Iceland";
default:
return "China";
}
}
public static String getCustomerName(int betweenZeroAndTen) {
switch (betweenZeroAndTen) {
case 0:
return "Brishen";
case 1:
return "Andy";
case 2:
return "Tony";
case 3:
return "Wayne";
case 4:
return "Jhon";
case 5:
return "PaPa";
case 6:
return "Juyne";
case 7:
return "Marry";
case 8:
return "Harmony";
case 9:
return "Brandon";
case 10:
return "Carlyle";
default:
return "
补充:软件开发 , Java ,