public static byte[] asBytes(String basicString){
  final byte[] b=new byte[basicString.length()];
  for (int i=0; i < b.length; ++i) {
    b[i]=(byte)basicString.charAt(i);
  }
  return b;
}

public static byte [ ] asBytes ( String basicString ) { final byte [ ] b = new byte [ basicString . length ( ) ] ; for ( int i = 0 ; i < b . length ; ++ i ) { b [ i ] = ( byte ) basicString . charAt ( i ) ; } return b ; }
get the corresponding byte array for a basic string . this is effectively the char [ ] array cast to bytes [ ] , as chars in basic strings only use the least significant byte .
