List of usage examples for java.util Locale CHINESE
Locale CHINESE
To view the source code for java.util Locale CHINESE.
Click Source Link
From source file:Main.java
public static void main(String[] args) { Locale locale = Locale.CHINESE; System.out.println("Locale1:" + locale); // print the country of this locale System.out.println("Country:" + locale.getCountry()); }
From source file:com.iveely.computing.Program.java
/** * @param args the command line arguments * @throws java.io.IOException//from ww w.j a va2 s .c o m */ public static void main(String[] args) throws IOException { if (args != null && args.length > 0) { logger.info("start computing with arguments:" + String.join(",", args)); String type = args[0].toLowerCase(Locale.CHINESE); switch (type) { case "master": launchMaster(); return; case "slave": if (args.length == 4) { ConfigWrapper.get().getSlave().setPort(Integer.parseInt(args[1])); ConfigWrapper.get().getSlave().setSlot(Integer.parseInt(args[2])); ConfigWrapper.get().getSlave().setSlotCount(Integer.parseInt(args[3])); } launchSlave(); return; case "supervisor": launchSupervisor(); return; case "console": launchConsole(); return; } } logger.error("arguments error,example [master | supervisor | slave | console]"); System.out.println("press any keys to exit..."); new BufferedReader(new InputStreamReader(System.in)).readLine(); }
From source file:Main.java
public static String calendarToDateString(Calendar calendar) { SimpleDateFormat formatter = new SimpleDateFormat("yyy-MM-dd", Locale.CHINESE); return formatter.format(calendar.getTime()); }
From source file:Main.java
public static String calendarToString(Calendar calendar) { SimpleDateFormat formatter = new SimpleDateFormat("yyy-MM-dd HH:mm", Locale.CHINESE); return formatter.format(calendar.getTime()); }
From source file:Main.java
public static Date String2Date(String date) { Date DateTime = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.CHINESE); try {/*from w w w. j av a 2 s . c om*/ DateTime = sdf.parse(date); } catch (ParseException e) { e.printStackTrace(); } return DateTime; }
From source file:Main.java
public static String getHourAndMinuteAndSecond(long mils) { mils /= 1000;/*from w w w. j ava2s . co m*/ int[] time = new int[3]; time[0] = (int) mils / 3600; time[1] = (int) mils / 60 % 60; time[2] = (int) mils % 60; return String.format(Locale.CHINESE, "%02d:%02d:%02d", time[0], time[1], time[2]); }
From source file:Main.java
/** * Compare Chinese string/*w ww . j a v a2 s .c o m*/ * @param chineseString1 * @param chineseString2 * @return */ public static int chineseCompare(String chineseString1, String chineseString2) { return Collator.getInstance(Locale.CHINESE).compare(chineseString1, chineseString2); }
From source file:Main.java
public static String getFileName(String suffix) { Date date = new Date(System.currentTimeMillis()); SimpleDateFormat dateFormat = new SimpleDateFormat("'xc'_yyyyMMddHHmmss", Locale.CHINESE); String randomNumber = "_" + new Random().nextInt(10000); return dateFormat.format(date) + randomNumber + suffix; }
From source file:Main.java
public static Calendar timeStringToCalendar(String timeString) { try {/*from www. j av a 2 s .co m*/ SimpleDateFormat formatter = new SimpleDateFormat("HH:mm", Locale.CHINESE); Date date = formatter.parse(timeString); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return calendar; } catch (ParseException e) { e.printStackTrace(); } return null; }
From source file:Main.java
public static Calendar stringToCalendar(String string) { try {/*from w w w .j a va2 s . c o m*/ SimpleDateFormat formatter = new SimpleDateFormat("yyy-MM-dd HH:mm", Locale.CHINESE); Date date = formatter.parse(string); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return calendar; } catch (ParseException e) { e.printStackTrace(); } return null; }