public static byte[] convertToBytes(String strValue){
  int length=strValue.length();
  byte[] bytes=new byte[length];
  for (int i=0; i < length; i++) {
    int c=strValue.charAt(i) & 255;
    if (c > 127) {
      c=-(c - 127);
    }
    bytes[i]=(byte)c;
  }
  return bytes;
}

public static byte [ ] convertToBytes ( String strValue ) { int length = strValue . length ( ) ; byte [ ] bytes = new byte [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { int c = strValue . charAt ( i ) & 255 ; if ( c > 127 ) { c = - ( c - 127 ) ; } bytes [ i ] = ( byte ) c ; } return bytes ; }
converts string to byte array . this is loosy algorithm because it gets only first byte from each char .
