List of utility methods to do Integer Convert To
double[] | convertIntToDouble(final int[] intValues) convert Int To Double if (intValues == null) { return null; if (intValues.length == 0) { return new double[0]; final double[] doubleValues = new double[intValues.length]; for (int valueIndex = 0; valueIndex < intValues.length; valueIndex++) { ... |
byte[] | convertIntToDWord(final int value) Converts an integer to an Motorola 86000er dword byte array byte[] buf = new byte[4]; buf[0] = (byte) ((value >> 24) & 0xFF); buf[1] = (byte) ((value >> 16) & 0xFF); buf[2] = (byte) ((value >> 8) & 0xFF); buf[3] = (byte) ((value) & 0xFF); return buf; |
Long | convertIntToLong(Integer intId) Interprets integer byte representation stored in 'db' as a long if (intId == null) { return null; } else { return Long.valueOf(intId.intValue() & 0xffffffffL); |
int[] | convertInttoMultiByte(int val) Works for positive values only if (val < 0) { throw new IllegalArgumentException("Negative values are not supported"); int size = 0; if ((val >> 24) > 0) { size = 4; } else if ((val >> 16) > 0) { size = 3; ... |
char[] | convertIntToTwoChar(int n) convert Int To Two Char char[] result = new char[2]; result[0] = (char) (n >>> 16); result[1] = (char) (0x0000FFFF & n); return result; |
byte[] | convertIntToUsignedBytes(int integer) converts positive or zero integer to bytes array if (integer < 0) { throw new IllegalArgumentException("Integer must be positive or zero!"); return new byte[] { (byte) ((0xff000000 & integer) >>> 24), (byte) ((0x00ff0000 & integer) >>> 16), (byte) ((0x0000ff00 & integer) >> 8), (byte) (0x000000ff & integer) }; |
int | fromInt(byte[] buffer, int pos, int i) from Int buffer[pos] = (byte) (i >> 24); buffer[pos + 1] = (byte) ((i >> 16) & 255); buffer[pos + 2] = (byte) ((i >> 8) & 255); buffer[pos + 3] = (byte) (i & 255); return pos + 4; |
boolean[] | fromInt(final int value, final int length) from Int boolean[] result = new boolean[length]; final boolean isNegative = (value < 0); int divResult = isNegative ? -value : value; int index = length - 1; while (divResult > 0) { final int remains = divResult % 2; result[index--] = (remains == 1); divResult /= 2; ... |
byte | fromInt(int i) from Int if (i > 256) { throw new IllegalArgumentException("Number " + i + " too big"); if (i > 127) { return (byte) (i - 256); return (byte) i; |
Boolean | fromint(int i) fromint if (i == 0) { return false; } else { return true; |