cdm/src/main/java/ucar/nc2/iosp/IospHelper.java
static public char[] convertByteToChar(byte[] byteArray) {
    int size = byteArray.length;
    char[] cbuff = new char[size];
    for (int i = 0; i < size; i++)
      cbuff[i] = (char) DataType.unsignedByteToShort(byteArray[i]); // NOTE: not Unicode !
    return cbuff;
  }

  // convert char array to byte array

  static public byte[] convertCharToByte(char[] from) {
    byte[] to = null;
    if (from != null) {
      int size = from.length;
      to = new byte[size];
      for (int i = 0; i < size; i++)
        to[i] = (byte) from[i]; // LOOK wrong, convert back to unsigned byte ???
    }
    return to;
  }
static public char[] convertByteToChar(byte[] byteArray) {
    int size = byteArray.length;
    char[] cbuff = new char[size];
    for (int i = 0; i < size; i++)
      cbuff[i] = (char) DataType.unsignedByteToShort(byteArray[i]); // NOTE: not Unicode !
    return cbuff;
  }

  // convert char array to byte array

  static public byte[] convertCharToByte(char[] from) {
    byte[] to = null;
    if (from != null) {
      int size = from.length;
      to = new byte[size];
      for (int i = 0; i < size; i++)
        to[i] = (byte) from[i]; // LOOK wrong, convert back to unsigned byte ???
    }
    return to;
  }
static public char [ ] convertByteToChar ( byte [ ] byteArray ) { int size = byteArray . length ; char [ ] cbuff = new char [ size ] ; for ( int i = 0 ; i < size ; i ++ ) cbuff [ i ] = ( char ) DataType . unsignedByteToShort ( byteArray [ i ] ) ; // NOTE: not Unicode !
 return cbuff ; } // convert char array to byte array
 static public byte [ ] convertCharToByte ( char [ ] from ) { byte [ ] to = null ; if ( from != null ) { int size = from . length ; to = new byte [ size ] ; for ( int i = 0 ; i < size ; i ++ ) to [ i ] = ( byte ) from [ i ] ; // LOOK wrong, convert back to unsigned byte ???
 } return to ; }
convert byte array to char array
convert byte array to char array