List of utility methods to do Integer Create
int | toInteger(byte[] b) Convert a 4 bytes array into an integer number. if (b.length != NUM_OCTETS_INTEGER) { throw new IllegalArgumentException("Invalid byte array length: " + b.length); int index = 0; int value = (b[index++] & MASK_BYTE) << INT_SHIFT_OCTET1; value |= (b[index++] & MASK_BYTE) << INT_SHIFT_OCTET2; value |= (b[index++] & MASK_BYTE) << INT_SHIFT_OCTET3; return value | (b[index] & MASK_BYTE); ... |
int | toInteger(byte[] b) Converts the bytes in an array into the corresponding integer value. return toInteger(b, 0);
|
int | toInteger(byte[] bytes) to Integer return ((bytes[0] & 0xff) << 24) | ((bytes[1] & 0xff) << 16) | ((bytes[2] & 0xff) << 8) | (bytes[3] & 0xff);
|
int | toInteger(byte[] bytes) Convert a byte array to an integer. return toInteger(bytes, true);
|
int | toInteger(byte[] bytes, int index) Convert the necessary number of bytes starting at the given index to an int. int val = 0; int typeBytes = Integer.SIZE / Byte.SIZE; checkBounds(bytes, index, typeBytes); for (int i = 0; i < typeBytes; i++) { int b = bytes[index++]; b = (b < 0) ? b + 256 : b; int shiftBits = Byte.SIZE * (typeBytes - i - 1); val += (b << shiftBits); ... |
int | toInteger(byte[] input) to Integer return toInteger(input, 0);
|
int | toInteger(E val) to Integer @SuppressWarnings("unchecked") E[] vals = (E[]) val.getClass().getEnumConstants(); for (int idx = 0; idx < vals.length; idx++) { if (vals[idx] == val) return idx; throw new IllegalArgumentException(); |
int | toInteger(final byte[] data) Converts the 4-byte array to a Big Endian int. if (data.length != 4) { throw new IllegalArgumentException("data must be of length 4"); return toInteger(data, 0); |
Integer | toInteger(final Double value) to Integer Integer integerValue = null; if (value != null) { integerValue = value.intValue(); return integerValue; |
int | toInteger(final Object o) Metodo que devuelve un numero de tipo Int a partir de un String return Integer.parseInt(String.valueOf(o));
|