List of utility methods to do Integer to Byte
void | intToByte(byte[] buf, int off, int value) int To Byte buf[0 + off] = (byte) ((value >>> 24) & 0xFF); buf[1 + off] = (byte) ((value >>> 16) & 0xFF); buf[2 + off] = (byte) ((value >>> 8) & 0xFF); buf[3 + off] = (byte) ((value >>> 0) & 0xFF); |
byte | intToByte(final int i) Convert an integer (0 to 255) into a byte (-128 to 127). int percent = (i * Byte.MAX_VALUE) / PERCENT_MAX; byte ret = (byte) (percent & HEX_FF); return ret; |
byte[] | intToByte(int i) Converts a given integer value to a byte array final byte[] b = new byte[4]; for (int j = 3; j >= 0; j--) { b[j] = (byte) (i & 0xFF); i >>= 8; return b; |
byte | IntToByte(int i) Int To Byte return (byte) i; |
byte | intToByte(int i) int To Byte if (i < 255) { return (byte) (i & 0xFF); } else { throw new NumberFormatException("Integer is more than 255 !"); |
Byte | intToByte(int i) int To Byte if (i >= Byte.MIN_VALUE && i <= Byte.MAX_VALUE) { return (byte) i; return null; |
byte[] | intToByte(int i_Value) int To Byte byte[] v_Ret = new byte[4]; v_Ret[0] = (byte) ((i_Value >>> 24) & 0xFF); v_Ret[1] = (byte) ((i_Value >>> 16) & 0xFF); v_Ret[2] = (byte) ((i_Value >>> 8) & 0xFF); v_Ret[3] = (byte) ((i_Value >>> 0) & 0xFF); return v_Ret; |
byte | intToByte(int myInt) Converts integer to byte value. return (byte) (myInt & 0xff); |
byte | intToByte(int num) int To Byte byte high = (byte) ((num >> 4) & 0x0F); byte low = (byte) (num & 0x0F); byte value = (byte) ((high << 4) + low); return value; |
byte | intToByte(int number) Converts a int to a byte. if (number <= 255 && number > 0) return (byte) number; else return Byte.MIN_VALUE; |