docs: private static String getEncodedData(boolean[] correctedBits) {
      int endIndex = correctedBits.length;
      Table latchTable = Table.UPPER; // table most recently latched to
      Table shiftTable = Table.UPPER; // table to use for the next read
      StringBuilder result = new StringBuilder(20);
      int index = 0;
      while (index < endIndex) {
        if (shiftTable == Table.BINARY) {
          if (endIndex - index < 5) {
            break;
          }
          int length = readCode(correctedBits, index, 5);
          index += 5;
          if (length == 0) {
            if (endIndex - index < 11) {
              break;
            }
            length = readCode(correctedBits, index, 11) + 31;
            index += 11;
          }
          for (int charCount = 0; charCount < length; charCount++) {
            if (endIndex - index < 8) {
              index = endIndex;  // Force outer loop to exit
              break;
            }
            int code = readCode(correctedBits, index, 8);
            result.append((char) code);
            index += 8;
          }
          // Go back to whatever mode we had been in
          shiftTable = latchTable;
        } else {
          int size = shiftTable == Table.DIGIT ? 4 : 5;
          if (endIndex - index < size) {
            break;
          }
          int code = readCode(correctedBits, index, size);
          index += size;
          String str = getCharacter(shiftTable, code);
          if (str.startsWith("CTRL_")) {
            // Table changes
            // ISO/IEC 24778:2008 prescribes ending a shift sequence in the mode from which it was invoked.
            // That's including when that mode is a shift.
            // Our test case dlusbs.png for issue #642 exercises that.
            latchTable = shiftTable;  // Latch the current mode, so as to return to Upper after U/S B/S
            shiftTable = getTable(str.charAt(5));
            if (str.charAt(6) == 'L') {
              latchTable = shiftTable;
            }
          } else {
            result.append(str);
            // Go back to whatever mode we had been in
            shiftTable = latchTable;
          }
        }
      }
      return result.toString();
    }