question: private static void decodeEdifactSegment ( BitSource bits , StringBuilder result ) { do { if ( bits . available ( ) <= 16 ) { return ; } for ( int i = 0 ; i < 4 ; i ++ ) { int edifactValue = bits . readBits ( 6 ) ; if ( edifactValue == 0x1F ) { int bitsLeft = 8 - bits . getBitOffset ( ) ; if ( bitsLeft != 8 ) { bits . readBits ( bitsLeft ) ; } return ; } if ( ( edifactValue & 0x20 ) == 0 ) { edifactValue |= 0x40 ; } result . append ( ( char ) edifactValue ) ; } } while ( bits . available ( ) > 0 ) ; }
target:  See ISO 16022:2006, 5.2.8 and Annex C Table C.3