class ITFWriter extends OneDimensionalCodeWriter {

  private static final int[] START_PATTERN = {1, 1, 1, 1};
  private static final int[] END_PATTERN = {3, 1, 1};

  private static final int W = 3; // Pixel width of a 3x wide line
  private static final int N = 1; // Pixed width of a narrow line

  // See ITFReader.PATTERNS

  private static final int[][] PATTERNS = {
      {N, N, W, W, N}, // 0
      {W, N, N, N, W}, // 1
      {N, W, N, N, W}, // 2
      {W, W, N, N, N}, // 3
      {N, N, W, N, W}, // 4
      {W, N, W, N, N}, // 5
      {N, W, W, N, N}, // 6
      {N, N, N, W, W}, // 7
      {W, N, N, W, N}, // 8
      {N, W, N, W, N}  // 9
  };

  @Override
  protected Collection<BarcodeFormat> getSupportedWriteFormats() {
    return Collections.singleton(BarcodeFormat.ITF);
  }

  @Override
  public boolean[] encode(String contents) {<FILL_FUNCTION_BODY>}

}

    int length = contents.length();
    if (length % 2 != 0) {
      throw new IllegalArgumentException("The length of the input should be even");
    }
    if (length > 80) {
      throw new IllegalArgumentException(
          "Requested contents should be less than 80 digits long, but got " + length);
    }

    checkNumeric(contents);

    boolean[] result = new boolean[9 + 9 * length];
    int pos = appendPattern(result, 0, START_PATTERN, true);
    for (int i = 0; i < length; i += 2) {
      int one = Character.digit(contents.charAt(i), 10);
      int two = Character.digit(contents.charAt(i + 1), 10);
      int[] encoding = new int[10];
      for (int j = 0; j < 5; j++) {
        encoding[2 * j] = PATTERNS[one][j];
        encoding[2 * j + 1] = PATTERNS[two][j];
      }
      pos += appendPattern(result, pos, encoding, true);
    }
    appendPattern(result, pos, END_PATTERN, true);

    return result;
  
<methods>public non-sealed void <init>() ,public abstract boolean[] encode(java.lang.String) ,public boolean[] encode(java.lang.String, Map<com.google.zxing.EncodeHintType,?>) ,public final com.google.zxing.common.BitMatrix encode(java.lang.String, com.google.zxing.BarcodeFormat, int, int) ,public com.google.zxing.common.BitMatrix encode(java.lang.String, com.google.zxing.BarcodeFormat, int, int, Map<com.google.zxing.EncodeHintType,?>) ,public int getDefaultMargin() <variables>private static final java.util.regex.Pattern NUMERIC