Java Byte Array Create toBytes(char[] chars)

Here you can find the source of toBytes(char[] chars)

Description

to Bytes

License

Apache License

Declaration

public static byte[] toBytes(char[] chars) 

Method Source Code

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

public class Main {
    public static byte[] toBytes(char[] chars) {
        byte[] ret = new byte[chars.length];
        for (int i = 0; i < chars.length; i++) {
            ret[i] = (byte) chars[i];
        }/*from  w ww  .ja  v  a 2 s.co  m*/
        return ret;
    }
}

Related

  1. toBytes(byte[] ipAddress, int port)
  2. toBytes(Byte[] values)
  3. toBytes(char c)
  4. toBytes(char value)
  5. toBytes(char[] cbuf, byte[] bs)
  6. toBytes(final byte[] s, final int off, final int len)
  7. toBytes(final long n)
  8. toBytes(final long val)
  9. toBytes(final String hexaString)