public static String toExtendedASCIIs ( byte [ ] bytes , int n , ByteOrder bo ) { RubyArray < String > ra = Ruby . Array . create ( ) ; if ( bo == LITTLE_ENDIAN ) { for ( int i = 0 ; i < n ; i ++ ) { if ( i >= bytes . length ) { ra . push ( "\0" ) ; continue ; } byte b = bytes [ i ] ; ra . push ( toASCII8Bit ( b ) ) ; } return ra . join ( ) ; } else { for ( int i = bytes . length - 1 ; n > 0 ; i -- ) { if ( i < 0 ) { ra . unshift ( "\0" ) ; n -- ; continue ; } byte b = bytes [ i ] ; ra . unshift ( toASCII8Bit ( b ) ) ; n -- ; } return ra . join ( ) ; } }
Converts a byte array into an ASCII String .