List of utility methods to do Integer Create
int | toInt(Object vo) to Int if (vo == null) { return 0; String voStr = toString(vo); try { return Integer.parseInt(voStr); } catch (Exception e) { return 0; |
int | toInt(short leftShort, short rightShort) to Int int leftInt = leftShort; int rightInt = rightShort; return leftInt | (rightInt << 16); |
int | ToInt(short n1, short n2) To Int byte[] bytes = new byte[4]; bytes[1] = (byte) (n1 & 0xff); bytes[0] = (byte) ((n1 >> 8) & 0xff); bytes[3] = (byte) (n2 & 0xff); bytes[2] = (byte) ((n2 >> 8) & 0xff); return ToInt(bytes); |
int | toInt(short s0, short s1) Returns an int built from two shorts. return (s0 & 0xFFFF) | (s1 << 16);
|
int | toInt(short x, short y) to Int return (x << 16) | (y & 0xffff);
|
int[] | toInt(short[] arr) Converts an array of short values to an array of integer values. int n = arr.length; int[] converted = new int[n]; for (int i = 0; i < n; i++) { converted[i] = arr[i]; return converted; |
int[] | toInt(String arr, String separator) to Int if (arr == null || "".equals(arr)) { return new int[0]; String[] array = arr.split(separator); int[] r = new int[array.length]; for (int i = 0; i < array.length; i++) { r[i] = Integer.parseInt(array[i]); return r; |
int | toInt(String chars) to Int if (chars.length() != 4) { throw new RuntimeException("chars should be 4 characters long"); return toInt(chars.charAt(0), chars.charAt(1), chars.charAt(2), chars.charAt(3)); |
int | toInt(String input, int defaultValue) to Int try { return Integer.parseInt(input); } catch (Exception e) { return defaultValue; |
int | toInt(String input, int offset, int length) Converts the given string into an integer using Horner's method. if (length == 1) { return input.charAt(offset) - '0'; int out = 0; for (int i = offset + length - 1, factor = 1; i >= offset; --i, factor *= 10) { out += (input.charAt(i) - '0') * factor; return out; ... |