code: public DecoderResult decode(BitMatrix bits) throws FormatException, ChecksumException {
  
      // Construct a parser and read version, error-correction level
      BitMatrixParser parser = new BitMatrixParser(bits);
      Version version = parser.getVersion();
  
      // Read codewords
      byte[] codewords = parser.readCodewords();
      // Separate into data blocks
      DataBlock[] dataBlocks = DataBlock.getDataBlocks(codewords, version);
  
      // Count total number of data bytes
      int totalBytes = 0;
      for (DataBlock db : dataBlocks) {
        totalBytes += db.getNumDataCodewords();
      }
      byte[] resultBytes = new byte[totalBytes];
  
      int dataBlocksCount = dataBlocks.length;
      // Error-correct and copy data blocks together into a stream of bytes
      for (int j = 0; j < dataBlocksCount; j++) {
        DataBlock dataBlock = dataBlocks[j];
        byte[] codewordBytes = dataBlock.getCodewords();
        int numDataCodewords = dataBlock.getNumDataCodewords();
        correctErrors(codewordBytes, numDataCodewords);
        for (int i = 0; i < numDataCodewords; i++) {
          // De-interlace data blocks.
          resultBytes[i * dataBlocksCount + j] = codewordBytes[i];
        }
      }
  
      // Decode the contents of that stream of bytes
      return DecodedBitStreamParser.decode(resultBytes);
    }
docs: <p>Decodes a Data Matrix Code represented as a {@link BitMatrix}. A 1 or "true" is taken
  to mean a black module.</p>
  
  @param bits booleans representing white/black Data Matrix Code modules
  @return text and bytes encoded within the Data Matrix Code
  @throws FormatException if the Data Matrix Code cannot be decoded
  @throws ChecksumException if error correction fails