public DecoderResult decode(AztecDetectorResult detectorResult) throws FormatException {
    ddata = detectorResult;
    BitMatrix matrix = detectorResult.getBits();
    boolean[] rawbits = extractBits(matrix);
    CorrectedBitsResult correctedBits = correctBits(rawbits);
    byte[] rawBytes = convertBoolArrayToByteArray(correctedBits.correctBits);
    String result = getEncodedData(correctedBits.correctBits);
    DecoderResult decoderResult =
        new DecoderResult(rawBytes, result, null, String.format("%d%%", correctedBits.ecLevel));
    decoderResult.setNumBits(correctedBits.correctBits.length);
    decoderResult.setErrorsCorrected(correctedBits.errorsCorrected);
    return decoderResult;
  }
@Test
  public void testAztecResultECI() throws FormatException {
    BitMatrix matrix = BitMatrix.parse(
        "      X     X X X   X           X     \n" +
        "    X X   X X   X X X X X X X   X     \n" +
        "    X X                         X   X \n" +
        "  X X X X X X X X X X X X X X X X X   \n" +
        "      X                       X       \n" +
        "      X   X X X X X X X X X   X   X   \n" +
        "  X X X   X               X   X X X   \n" +
        "  X   X   X   X X X X X   X   X X X   \n" +
        "      X   X   X       X   X   X X X   \n" +
        "  X   X   X   X   X   X   X   X   X   \n" +
        "X   X X   X   X       X   X   X     X \n" +
        "  X X X   X   X X X X X   X   X X     \n" +
        "      X   X               X   X X   X \n" +
        "      X   X X X X X X X X X   X   X X \n" +
        "  X   X                       X       \n" +
        "X X   X X X X X X X X X X X X X X X   \n" +
        "X X     X   X         X X X       X X \n" +
        "  X   X   X   X X X X X     X X   X   \n" +
        "X     X       X X   X X X       X     \n",
        "X ", "  ");
    AztecDetectorResult r = new AztecDetectorResult(matrix, NO_POINTS, false, 15, 1);
    DecoderResult result = new Decoder().decode(r);
    assertEquals("Français", result.getText());
  }