List of utility methods to do Integer Create
Integer | toInt(String[] s, int i) to Int if (s[i].equals("*")) { return Integer.MAX_VALUE; } else { return Integer.parseInt(s[i]); |
int | toInt(T value) to Int return Integer.parseInt(String.valueOf(value));
|
int[] | toInt(T[] v) to Int if (v == null) return null; int[] newv = new int[v.length]; for (int i = 0; i < v.length; i++) newv[i] = ((Integer) v[i]); return newv; |
byte[] | toInt24(final int value) to Int return new byte[] { (byte) (value >>> 16), (byte) (value >>> 8), (byte) value }; |
int | toInt32(int[] data, int startIndex) Extract a signed 32-bit number from an array of int data int dataLength = 4; int length = data.length; if (startIndex < 0 || (startIndex + dataLength) > length) { throw new IndexOutOfBoundsException("Index: " + startIndex + ", Length: " + length); int value = 0; for (int i = 0; i < dataLength; i++) { value = (value << 8) + data[startIndex + i]; ... |
int | toInt32(long x) to Int if ((int) x == x) { return (int) x; throw new IllegalArgumentException("Int " + x + " out of range"); |
int | toInt32(Object prmIntObject) to Int return toInt(prmIntObject);
|
int | toInt4Trim(String value, int _default) to Int Trim if (value == null || value.trim().length() == 0) return _default; try { return Integer.valueOf(value); } catch (Exception e) { e.printStackTrace(); return _default; ... |
int[] | toIntA(byte[] data) to Int A if (data == null || data.length % 4 != 0) return null; int[] ints = new int[data.length / 4]; for (int i = 0; i < ints.length; i++) ints[i] = toInt(new byte[] { data[(i * 4)], data[(i * 4) + 1], data[(i * 4) + 2], data[(i * 4) + 3], }); return ints; |
int[] | toIntArr(String s, String split) to Int Arr String[] intStr = s.split(split); int[] res = new int[intStr.length]; for (int i = 0; i < intStr.length; ++i) { res[i] = toInt(intStr[i]); return res; |