code: public static void decodePackbits(byte data[], byte[] dst) {
          int srcCount = 0, dstCount = 0;
          byte repeat, b;
          
          try {
              while (dstCount < dst.length) {
                  b = data[srcCount++];
                  if (b >= 0 && b <= 127) {
                      // literal run packet
                      for (int i=0; i<(b + 1); i++) {
                          dst[dstCount++] = data[srcCount++];
                      }
  
                  } else if (b <= -1 && b >= -127) {
                      // 2 byte encoded run packet
                      repeat = data[srcCount++];
                      for (int i=0; i<(-b + 1); i++) {
                          dst[dstCount++] = repeat;
                      }
                  } else {
                      // no-op packet. Do nothing
                      srcCount++;
                  }
              }
          }
          catch (Exception e) {
              // do nothing
          }
      }
docs: Uncompress packbits compressed image data.