List of utility methods to do Char to Byte Array
byte[] | charToByteArray(char value) char To Byte Array return shortToByteArray(value);
|
byte[] | charToByteArrayBE(char data) Convert a char to a byte array (big endian). return new byte[] { (byte) ((data >> 8) & 0xff), (byte) ((data >> 0) & 0xff), }; |
int | charToBytes(byte[] arr, int offset, char c) char To Bytes arr[offset + 0] = (byte) ((int) (c & 0xFF00) >> 8); arr[offset + 1] = (byte) (c & 0xFF); return 2; |
byte[] | charToBytes(char c) char To Bytes byte[] b = new byte[8]; b[0] = (byte) (c >>> 8); b[1] = (byte) c; return b; |
void | charToBytes(char c, byte[] arr, int pos) Writes a character to a byte array, taking up 2 bytes. checkBounds(arr, pos); arr[pos] = (byte) ((c & 0xFF00) >> 8); arr[pos + 1] = (byte) (c & 0x00FF); |
byte[] | charToBytes(char[] buffer) char To Bytes byte[] b = new byte[buffer.length << 1]; for (int i = 0; i < buffer.length; i++) { int bpos = i << 1; b[bpos] = (byte) ((buffer[i] & 0xFF00) >> 8); b[bpos + 1] = (byte) (buffer[i] & 0x00FF); return b; |
byte[] | charToBytes(final char i) char To Bytes return stringToBytes(Character.toString(i));
|