2025-05-23


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 ”

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *