List of usage examples for java.lang Integer valueOf
@HotSpotIntrinsicCandidate public static Integer valueOf(int i)
From source file:license.regist.ReadProjectInfo.java
private static byte[] md5(String info) throws Exception { MessageDigest md = MessageDigest.getInstance("MD5"); StringBuilder sb = new StringBuilder(); for (int i = 0; i < info.length(); i++) sb.append(Integer.valueOf(info.charAt(i))); return md.digest(sb.toString().getBytes()); }
From source file:com.biendltb.main_server.TripMapServer.java
private static int getPortFromArgs(String[] args) { if (args.length > 0) { try {/*from ww w .j av a 2 s .c o m*/ return Integer.valueOf(args[0]); } catch (NumberFormatException ignore) { } } return DEFAULT_PORT; }
From source file:Main.java
private static boolean keineKlassenstufeEnthalten(String klassenstufe) { try {/*from w w w . j a v a 2 s .c o m*/ Integer.valueOf(klassenstufe); return false; } catch (NumberFormatException e) { return true; } }
From source file:com.github.notizklotz.derbunddownloader.settings.TimePickerPreference.java
public static Integer[] toHourMinuteIntegers(String timeString) { if (!StringUtils.hasText(timeString)) { throw new IllegalArgumentException("timeString must not be blank"); }//from w ww . jav a 2 s . co m String[] values = timeString.split(":|/"); Integer hour = Integer.valueOf(values[0]); Integer minute = Integer.valueOf(values[1]); return new Integer[] { hour, minute }; }
From source file:Main.java
public static void sortingByFastStack(int[] intArray, boolean ascending) { Stack<Integer> sa = new Stack<Integer>(); sa.push(0);//from w w w. ja va2 s . c o m sa.push(intArray.length - 1); while (!sa.isEmpty()) { int end = ((Integer) sa.pop()).intValue(); int start = ((Integer) sa.pop()).intValue(); int i = start; int j = end; int tmp = intArray[i]; if (ascending) { while (i < j) { while (intArray[j] > tmp && i < j) { j--; } if (i < j) { intArray[i] = intArray[j]; i++; } for (; intArray[i] < tmp && i < j; i++) { ; } if (i < j) { intArray[j] = intArray[i]; j--; } } } else { while (i < j) { while (intArray[j] < tmp && i < j) { j--; } if (i < j) { intArray[i] = intArray[j]; i++; } for (; intArray[i] > tmp && i < j; i++) { ; } if (i < j) { intArray[j] = intArray[i]; j--; } } } intArray[i] = tmp; if (start < i - 1) { sa.push(Integer.valueOf(start)); sa.push(Integer.valueOf(i - 1)); } if (end > i + 1) { sa.push(Integer.valueOf(i + 1)); sa.push(Integer.valueOf(end)); } } }
From source file:dicky.dao.MakeIdDAOImpl.java
@Override public String getId(String id, String awalan, int panjangField) { String max = ""; int nomber = 0; String strTmp = ""; int panjangId = panjangField - awalan.length(); int panjangNumber = 0; if (id.equals("")) { nomber = 0;//w w w . j a va 2 s .c o m } else { String idCut = id.substring(awalan.length(), panjangField); nomber = Integer.valueOf(idCut); } panjangNumber = String.valueOf(nomber + 1).length(); for (int i = 0; i < panjangId - panjangNumber; i++) { strTmp = strTmp + "0"; } max = awalan + strTmp + String.valueOf(nomber + 1); return max; }
From source file:max.hubbard.bettershops.Utils.ItemUtils.java
public static ItemStack fromString(String s) { Map<String, Object> map = stringToMap(s); for (String s1 : map.keySet()) { if (s1.contains("damage")) { map.put(s1, Integer.valueOf((String) map.get(s1))); break; }/*from w w w . j a va2s .c o m*/ } return ItemStack.deserialize(map); }
From source file:com.common.server.AppLicenceUtil.java
public static int userCount() throws Exception { Map map = getLicence();// w ww. ja v a 2s . c o m String userCount = (String) map.get("userCount"); if (userCount != null) { int count = Integer.valueOf(userCount).intValue(); return count; } else return 0; }
From source file:io.github.casnix.spawnerdropper.Config.java
public static int GetTNTChance() { try {//from w w w. ja va 2s .c o m // Read entire ./SpawnerDropper/SpawnerDropperConfig.json into a string // System.out.println("[SD DEBUG] 1"); String configTable = new String( Files.readAllBytes(Paths.get("./plugins/SpawnerDropper/SpawnerDropperConfig.json"))); // get the value of JSON->{spawnerType} // System.out.println("[SD DEBUG] 2"); JSONParser parser = new JSONParser(); // System.out.println("[SD DEBUG] 3"); Object obj = parser.parse(configTable); //System.out.println("[SD DEBUG] 4"); JSONObject jsonObj = (JSONObject) obj; // System.out.println("[SD DEBUG] 5"); String chance = (String) jsonObj.get("tntpercent"); // System.out.println("[SD DEBUG] 6"); // if(chance != null) // System.out.println("[SD DBG MSG] "+chance); // else // System.out.println("[SD DBG MSG] chance is null"); // System.out.println("[SD DEBUG] 7"); return Integer.valueOf(chance); //System.out.println("[SD DEBUG] 6"); //return chance; } catch (ParseException e) { Bukkit.getLogger().warning("[SpawnerDropper] Caught ParseException in GetTNTChance(void)"); e.printStackTrace(); return -1; } catch (FileNotFoundException e) { Bukkit.getLogger() .warning("[SpawnerDropper] Could not find ./plugins/SpawnerDropper/SpawnerDropperConfig.json"); e.printStackTrace(); return -1; } catch (IOException e) { Bukkit.getLogger().warning("[SpawnerDropper] Caught IOException in GetTNTChance(void)"); e.printStackTrace(); return -1; } }
From source file:com.enonic.cms.core.preference.PreferenceScopeKey.java
public PreferenceScopeKey(String key) { if (key == null) { throw new IllegalArgumentException("Given key cannot be null"); }/*from ww w. j a v a 2 s . c om*/ if (key.indexOf(":") > -1) { StringTokenizer st = new StringTokenizer(key, ":"); try { firstKey = Integer.valueOf(st.nextToken()); } catch (NumberFormatException e) { throw new InvalidKeyException(key, this.getClass(), "first key not a number"); } try { secondKey = Integer.valueOf(StringUtils.substringBefore(st.nextToken(), ".")); } catch (NumberFormatException e) { throw new InvalidKeyException(key, this.getClass(), "second key not a number"); } keyAsString = firstKey + ":" + secondKey; } else { try { firstKey = Integer.valueOf(key); } catch (NumberFormatException e) { throw new InvalidKeyException(key, this.getClass(), "first key not a number"); } keyAsString = firstKey.toString(); } }