Barcode Print on Android Studio with Bluetooth Printer

  android, java

I have the following code below in Android Studio, in the case of content with certain amounts of digits it works, but when it decreases the amount (3 digits) it doesn’t print anything.

Any tips on what you need to do to adjust the number of digits for printing?

private void print1DBarcode() {
    //String content  = "6901234567892";
    String content    = "2008693793";

    //1D barcode format (hex): 1d 6b 02 0d + barcode data

    byte[] contents = content.getBytes();
    byte[] formats  = {(byte) 0x1d, (byte) 0x6b, (byte) 0x02, (byte) 0x0d};

    byte[] bytes    = new byte[formats.length + contents.length];

    System.arraycopy(formats, 0, bytes, 0, formats.length);
    System.arraycopy(contents, 0, bytes, formats.length, contents.length);


    byte[] newline  = Printer.printfont("nn",FontDefine.FONT_32PX,FontDefine.Align_CENTER,(byte)0x1A,PocketPos.LANGUAGE_ENGLISH);

Source: Android Questions