List of usage examples for java.lang Integer valueOf
@HotSpotIntrinsicCandidate public static Integer valueOf(int i)
From source file:Main.java
/** * /* w w w . j a va 2s. c o m*/ * @param node * @param name * @return */ public static int getIntAttribute(Node node, String name) { String value = getStringAttribute(node, name); if (value != null && !value.isEmpty()) { return Integer.valueOf(value).intValue(); } else { return 0; } }
From source file:Main.java
public static int[] strToArray(String str) { if (!TextUtils.isEmpty(str)) { String[] strArray = str.split("\\."); int[] result = new int[strArray.length]; for (int i = 0; i < strArray.length; i++) { result[i] = Integer.valueOf(strArray[i]); }/*from www . ja v a 2 s. c o m*/ return result; } return null; }
From source file:Main.java
/** * Convert String into int ,return 0 if blank string or * @str string to convert/*from ww w .j a va 2s . c o m*/ * */ public static int getInt(String str) { if (TextUtils.isEmpty(str)) { return 0; } else { try { return Integer.valueOf(str); } catch (Exception e) { } return 0; } }
From source file:Main.java
public static long getAsInteger(final ContentValues values, final String key, final int def) { if (values == null || key == null) return def; final Object value = values.get(key); if (value == null) return def; return Integer.valueOf(value.toString()); }
From source file:Main.java
public static int formatNum2Int(double v) { return Integer.valueOf(df_int.format(v)); }
From source file:Main.java
public static void keep_setInt(Field field, Object obj, Cursor cursor, int i) { try {/*w w w . j a v a 2 s.co m*/ if (field.getType().equals(Integer.TYPE)) field.setInt(obj, cursor.getInt(i)); else field.set(obj, Integer.valueOf(cursor.getInt(i))); } catch (Exception exception) { exception.printStackTrace(); } }
From source file:Main.java
private static int parserColor(String value) { String regularExpression = ","; if (value.contains(regularExpression)) { String[] temp = value.split(regularExpression); int color = Color.parseColor(temp[0]); int alpha = Integer.valueOf(temp[1]); int red = (color & 0xff0000) >> 16; int green = (color & 0x00ff00) >> 8; int blue = (color & 0x0000ff); return Color.argb(alpha, red, green, blue); }/*w ww. j a v a 2 s. co m*/ return Color.parseColor(value); }
From source file:Main.java
public static List<Integer> stringToPassword(String string) { List<Integer> result = new ArrayList<Integer>(); final byte[] bytes = string.getBytes(); for (int i = 0; i < bytes.length; i++) { byte b = bytes[i]; result.add(Integer.valueOf(b)); }/*from ww w . j a va2 s . com*/ return result; }
From source file:Main.java
private static int[] getSnrAndChannelData(String snr, String channel) { List<Integer> dateItem = new ArrayList(); int intSrn = Integer.valueOf(snr) * 100; String hexSnr = Integer.toHexString(intSrn); if (hexSnr.length() < 4) { switch (hexSnr.length()) { case 1://from w ww.j av a2s . c om hexSnr = "000" + hexSnr; break; case 2: hexSnr = "00" + hexSnr; break; case 3: hexSnr = "0" + hexSnr; break; } } dateItem.add(Integer.valueOf(hexSnr.substring(2, 4), 16)); dateItem.add(Integer.valueOf(hexSnr.substring(0, 2), 16)); for (int i = 0; i < 6; i++) { dateItem.add(0); } String hexChannel = Integer.toHexString(Integer.valueOf(channel)); if (hexChannel.length() < 4) { switch (hexChannel.length()) { case 1: hexChannel = "000" + hexChannel; break; case 2: hexChannel = "00" + hexChannel; break; case 3: hexChannel = "0" + hexChannel; break; } } dateItem.add(Integer.valueOf(hexChannel.substring(2, 4), 16)); dateItem.add(Integer.valueOf(hexChannel.substring(0, 2), 16)); for (int i = 0; i < 7; i++) { dateItem.add(0); } int[] message = new int[dateItem.size()]; for (int i = 0; i < dateItem.size(); i++) { // Logs.e("dateItem" + i + "===" + dateItem.get(i)); message[i] = dateItem.get(i); } return message; }
From source file:com.sm.store.TestRemoteCall.java
public static void main(String[] args) { String[] opts = new String[] { "-store", "-url", "-times" }; String[] defaults = new String[] { "store", "localhost:7100", "10" }; String[] paras = getOpts(args, opts, defaults); String store = paras[0];// w w w. j ava 2 s. c o m String url = paras[1]; int times = Integer.valueOf(paras[2]); RemoteClientImpl client = new NTRemoteClientImpl(url, null, store); for (int i = 0; i < times; i++) { try { int j = i % 4; Integer res = null; Invoker invoker; switch (j) { case 0: logger.info("+ j= " + j); invoker = new Invoker("com.sm.store.Operation", "add", new Integer[] { j++, j++ }); res = (Integer) client.invoke(invoker); break; case 1: logger.info("- j= " + j); invoker = new Invoker("com.sm.store.Operation", "substract", new Integer[] { j + 2, j }); res = (Integer) client.invoke(invoker); break; case 2: logger.info("X j= " + j); invoker = new Invoker("com.sm.store.Operation", "multiply", new Integer[] { j + 5, j }); res = (Integer) client.invoke(invoker); break; case 3: logger.info("Add j= " + j); invoker = new Invoker("com.sm.store.Operation", "div", new Integer[] { j + 10, j++ }); res = (Integer) client.invoke(invoker); break; default: logger.info("unknown bucket j=" + j); } logger.info("result i " + i + " j " + j + " res " + res.toString()); invoker = new Invoker("com.sm.store.Hello", "greeting", new String[] { "test-" + i }); logger.info("greeting " + (String) client.invoke(invoker)); } catch (Exception ex) { logger.error(ex.getMessage(), ex); } } client.close(); }