question: private static void decodeTextCompaction ( int [ ] textCompactionData , int [ ] byteCompactionData , int length , StringBuilder result ) { Mode subMode = Mode . ALPHA ; Mode priorToShiftMode = Mode . ALPHA ; int i = 0 ; while ( i < length ) { int subModeCh = textCompactionData [ i ] ; char ch = 0 ; switch ( subMode ) { case ALPHA : if ( subModeCh < 26 ) { ch = ( char ) ( 'A' + subModeCh ) ; } else { if ( subModeCh == 26 ) { ch = ' ' ; } else if ( subModeCh == LL ) { subMode = Mode . LOWER ; } else if ( subModeCh == ML ) { subMode = Mode . MIXED ; } else if ( subModeCh == PS ) { priorToShiftMode = subMode ; subMode = Mode . PUNCT_SHIFT ; } else if ( subModeCh == MODE_SHIFT_TO_BYTE_COMPACTION_MODE ) { result . append ( ( char ) byteCompactionData [ i ] ) ; } else if ( subModeCh == TEXT_COMPACTION_MODE_LATCH ) { subMode = Mode . ALPHA ; } } break ; case LOWER : if ( subModeCh < 26 ) { ch = ( char ) ( 'a' + subModeCh ) ; } else { if ( subModeCh == 26 ) { ch = ' ' ; } else if ( subModeCh == AS ) { priorToShiftMode = subMode ; subMode = Mode . ALPHA_SHIFT ; } else if ( subModeCh == ML ) { subMode = Mode . MIXED ; } else if ( subModeCh == PS ) { priorToShiftMode = subMode ; subMode = Mode . PUNCT_SHIFT ; } else if ( subModeCh == MODE_SHIFT_TO_BYTE_COMPACTION_MODE ) { result . append ( ( char ) byteCompactionData [ i ] ) ; } else if ( subModeCh == TEXT_COMPACTION_MODE_LATCH ) { subMode = Mode . ALPHA ; } } break ; case MIXED : if ( subModeCh < PL ) { ch = MIXED_CHARS [ subModeCh ] ; } else { if ( subModeCh == PL ) { subMode = Mode . PUNCT ; } else if ( subModeCh == 26 ) { ch = ' ' ; } else if ( subModeCh == LL ) { subMode = Mode . LOWER ; } else if ( subModeCh == AL ) { subMode = Mode . ALPHA ; } else if ( subModeCh == PS ) { priorToShiftMode = subMode ; subMode = Mode . PUNCT_SHIFT ; } else if ( subModeCh == MODE_SHIFT_TO_BYTE_COMPACTION_MODE ) { result . append ( ( char ) byteCompactionData [ i ] ) ; } else if ( subModeCh == TEXT_COMPACTION_MODE_LATCH ) { subMode = Mode . ALPHA ; } } break ; case PUNCT : if ( subModeCh < PAL ) { ch = PUNCT_CHARS [ subModeCh ] ; } else { if ( subModeCh == PAL ) { subMode = Mode . ALPHA ; } else if ( subModeCh == MODE_SHIFT_TO_BYTE_COMPACTION_MODE ) { result . append ( ( char ) byteCompactionData [ i ] ) ; } else if ( subModeCh == TEXT_COMPACTION_MODE_LATCH ) { subMode = Mode . ALPHA ; } } break ; case ALPHA_SHIFT : subMode = priorToShiftMode ; if ( subModeCh < 26 ) { ch = ( char ) ( 'A' + subModeCh ) ; } else { if ( subModeCh == 26 ) { ch = ' ' ; } else if ( subModeCh == TEXT_COMPACTION_MODE_LATCH ) { subMode = Mode . ALPHA ; } } break ; case PUNCT_SHIFT : subMode = priorToShiftMode ; if ( subModeCh < PAL ) { ch = PUNCT_CHARS [ subModeCh ] ; } else { if ( subModeCh == PAL ) { subMode = Mode . ALPHA ; } else if ( subModeCh == MODE_SHIFT_TO_BYTE_COMPACTION_MODE ) { result . append ( ( char ) byteCompactionData [ i ] ) ; } else if ( subModeCh == TEXT_COMPACTION_MODE_LATCH ) { subMode = Mode . ALPHA ; } } break ; } if ( ch != 0 ) { result . append ( ch ) ; } i ++ ; } }
target:  The Text Compaction mode includes all the printable ASCII characters (i.e. values from 32 to 126) and three ASCII control characters: HT or tab (ASCII value 9), LF or line feed (ASCII value 10), and CR or carriage return (ASCII value 13). The Text Compaction mode also includes various latch and shift characters which are used exclusively within the mode. The Text Compaction mode encodes up to 2 characters per codeword. The compaction rules for converting data into PDF417 codewords are defined in 5.4.2.2. The sub-mode switches are defined in 5.4.2.3.