Java Char to Byte Array charToBytes(char c)

Here you can find the source of charToBytes(char c)

Description

char To Bytes

License

Apache License

Declaration

public static byte[] charToBytes(char c) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static byte[] charToBytes(char c) {
        byte[] b = new byte[8];
        b[0] = (byte) (c >>> 8);
        b[1] = (byte) c;
        return b;
    }//from  w  w w . jav a  2  s.co  m
}

Related

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