List of usage examples for java.lang Integer valueOf
@HotSpotIntrinsicCandidate public static Integer valueOf(int i)
From source file:Main.java
public static boolean heightCheck(String heightStr) { if (heightStr == null || (heightStr.trim().equals(""))) { return false; }//from w w w .java2s .co m Pattern pattern = Pattern.compile("^[0-9]*$"); if (pattern.matcher(heightStr).matches()) { int hei = Integer.valueOf(heightStr); if ((hei > 140) && (hei < 200)) { return true; } else { return false; } } else { return false; } }
From source file:Main.java
public static Integer getIntAttribute(NamedNodeMap namedNodeMap, String name) { String value = getAttribute(namedNodeMap, name); if (value == null) { return null; } else {// w w w . j av a 2s .com return Integer.valueOf(value); } }
From source file:Main.java
public static List<Integer> getOccupantsIdsListFromString(String occupantIds) { List<Integer> occupantIdsList = new ArrayList<>(); String[] occupantIdsArray = occupantIds.split(","); for (String occupantId : occupantIdsArray) { occupantIdsList.add(Integer.valueOf(occupantId)); }/*from w w w . j a v a 2s.com*/ return occupantIdsList; }
From source file:Main.java
public static Integer[] getMinSec(String str) { Integer[] data = new Integer[2]; StringTokenizer tokens = new StringTokenizer(str, ","); int counter = 0; while (tokens.hasMoreTokens()) { String next = tokens.nextToken(); data[counter++] = Integer.valueOf(next); }/*w w w .java 2s . c o m*/ return data; }
From source file:Main.java
public static void samsungShortCut(Context context, String num) { int numInt = Integer.valueOf(num); if (numInt < 1) { num = "0"; } else if (numInt > 99) { num = "99"; }//from ww w . j a v a 2s. c o m String activityName = getLaunchActivityName(context); Intent localIntent = new Intent("android.intent.action.BADGE_COUNT_UPDATE"); localIntent.putExtra("badge_count", Integer.parseInt(num)); localIntent.putExtra("badge_count_package_name", context.getPackageName()); localIntent.putExtra("badge_count_class_name", activityName); context.sendBroadcast(localIntent); }
From source file:Main.java
public static String[] split(String s, char c, int limit) { if (s == null) { return null; }//from w ww .j a v a 2 s .c om ArrayList<Integer> pos = new ArrayList<Integer>(); int i = -1; while ((i = s.indexOf((int) c, i + 1)) > 0) { pos.add(Integer.valueOf(i)); } int n = pos.size(); int[] p = new int[n]; i = -1; for (int x : pos) { p[++i] = x; } if ((limit == 0) || (limit > n)) { limit = n + 1; } String[] result = new String[limit]; if (n > 0) { result[0] = s.substring(0, p[0]); } else { result[0] = s; } for (i = 1; i < limit - 1; ++i) { result[i] = s.substring(p[i - 1] + 1, p[i]); } if (limit > 1) { result[limit - 1] = s.substring(p[limit - 2] + 1); } return result; }
From source file:Main.java
/** * Return an integer representation of a BCD array. *//*from w ww. j a v a 2s.c o m*/ public static int bcdArrayToInt(byte[] bcdArray) { StringBuilder decimalString = new StringBuilder(); for (Byte b : bcdArray) { decimalString.append(String.format("%02X", b)); } return Integer.valueOf(decimalString.toString()); }
From source file:Main.java
public static Bitmap decodeResourcesBitmap(Context context, int res) { boolean bool = BITMAP_CACHE.containsKey(Integer.valueOf(res)); Bitmap localBitmap = null;//from w w w . j a v a 2 s . co m if (bool) { localBitmap = (Bitmap) BITMAP_CACHE.get(Integer.valueOf(res)); } if ((localBitmap == null) || (localBitmap.isRecycled())) { localBitmap = BitmapFactory.decodeStream(context.getResources().openRawResource(res)); BITMAP_CACHE.put(Integer.valueOf(res), localBitmap); } return localBitmap; }
From source file:Main.java
public static int[] getYMDArray(String datetime, String splite) { int[] date = { 0, 0, 0, 0, 0 }; if (datetime != null && datetime.length() > 0) { String[] dates = datetime.split(splite); int position = 0; for (String temp : dates) { date[position] = Integer.valueOf(temp); position++;// ww w . j a v a 2 s . c o m } } return date; }
From source file:Main.java
public static <K, V> List<Integer> getIndexListByValues(Map<K, V> map, Object[] values) { if ((values == null) || (values.length == 0)) { return null; }//from w w w . ja v a2s. com List<Integer> indexList = new ArrayList<Integer>(map.size()); Integer i = Integer.valueOf(0); for (V v : map.values()) { for (Object value : values) { if ((v == value) || (v.equals(value))) { indexList.add(i); } } i = Integer.valueOf(i.intValue() + 1); } return indexList; }