Java Char Array Create toCharArray(byte[] src)

Here you can find the source of toCharArray(byte[] src)

Description

to Char Array

License

Open Source License

Declaration

public static char[] toCharArray(byte[] src) 

Method Source Code

//package com.java2s;
// The MIT License (MIT)

public class Main {
    public static char[] toCharArray(byte[] src) {
        char[] arr = new char[src.length / 2];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = (char) (((0xff & (src[i * 2])) << 8) | (0xff & src[i * 2 + 1]));
        }//  w ww.j  av a  2 s.c  om
        return arr;
    }
}

Related

  1. toCharArray(boolean[] array)
  2. toCharArray(byte[] barr)
  3. toCharArray(byte[] byteArray)
  4. toCharArray(byte[] data)
  5. toCharArray(byte[] input)
  6. toCharArray(char... values)
  7. toCharArray(CharSequence chars)
  8. toCharArray(CharSequence charSequence)
  9. toCharArray(CharSequence charSequence)