List of utility methods to do Integer Convert To
long | convertInt(byte[] data) convert Int return ((data[3] & 0xFF) << 24) | ((data[2] & 0xFF) << 16) | ((data[1] & 0xFF) << 8) | (data[0] & 0xFF);
|
long | convertInt(byte[] data) convert Int return convertInt(data, false);
|
int | convertInt(String str, int defaults) convert Int if (str == null) { return defaults; try { return Integer.parseInt(str); } catch (Exception e) { return defaults; |
Number | convertInt(String str, int radix) convert Int long x = Long.parseLong(str, radix); if (x <= (long) Integer.MAX_VALUE && x >= (long) Integer.MIN_VALUE) { return new Integer((int) x); return new Long(x); |
int | convertInt(String value) convert Int try { return Integer.parseInt(value); } catch (Exception e) { return 0; |
Integer | convertInt(String valueAsString) convert Int return Integer.valueOf(valueAsString);
|
int[] | convertInt(String[] idArray) convert Int int[] desArray = new int[idArray.length]; for (int i = 0; i < desArray.length; i++) { desArray[i] = Integer.parseInt(idArray[i]); return desArray; |
byte | convertInt2Byte(int data) convert Int Byte return (byte) (0xFF & data); |
byte[] | convertInt2Bytes(int data) convert Int Bytes byte[] bytes = new byte[] { convertInt2Byte(data) }; return bytes; |
byte[] | convertInt32(int v, boolean isLE) Convert 32-bits integer value to bytes arrays. byte[] bytes = new byte[4]; if (isLE) { bytes[3] = (byte) ((v >>> 24) & 0xFF); bytes[2] = (byte) ((v >>> 16) & 0xFF); bytes[1] = (byte) ((v >>> 8) & 0xFF); bytes[0] = (byte) ((v >>> 0) & 0xFF); } else { bytes[0] = (byte) ((v >>> 24) & 0xFF); ... |