Java Char to Byte Array charToBytes(byte[] arr, int offset, char c)

Here you can find the source of charToBytes(byte[] arr, int offset, char c)

Description

char To Bytes

License

Open Source License

Declaration

public static int charToBytes(byte[] arr, int offset, char c) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static int charToBytes(byte[] arr, int offset, char c) {
        arr[offset + 0] = (byte) ((int) (c & 0xFF00) >> 8);
        arr[offset + 1] = (byte) (c & 0xFF);

        return 2;
    }/* ww w  .  j ava 2s.c om*/
}

Related

  1. charToByteArray(char value)
  2. charToByteArrayBE(char data)
  3. charToBytes(char c)
  4. charToBytes(char c, byte[] arr, int pos)
  5. charToBytes(char[] buffer)
  6. charToBytes(final char i)