public static byte [ ] getAsciiBytes ( String input ) { char [ ] c = input . toCharArray ( ) ; byte [ ] b = new byte [ c . length ] ; for ( int i = 0 ; i < c . length ; i ++ ) { b [ i ] = ( byte ) ( c [ i ] & 0x007F ) ; } return b ; }
Get 7 - bit ASCII character array from input String . The lower 7 bits of each character in the input string is assumed to be the ASCII character value .