if (lengths == null || values == null || lengths.length > 16 || values.length > 256) throw new IllegalArgumentException("invalid length or values array");  for (int i = 0; i < lengths.length; i++) { if (lengths[i] < 0) throw new IllegalArgumentException("negative length"); }  for (int i = 0; i < values.length; i++) { if (values[i] < 0) throw new IllegalArgumentException("negative value"); }  int sum = 0; for (int i = 0; i < lengths.length; i++) { if (lengths[i] > ((1 << (i + 1)) - 1)) throw new IllegalArgumentException("invalid number of codes" + " for code length " + (i + 1)); sum += lengths[i]; } if (values.length != sum) throw new IllegalArgumentException("invalid number of values" + " for number of codes");  this.lengths = new short[lengths.length]; System.arraycopy(lengths, 0, this.lengths, 0, lengths.length);  this.values = new short[values.length]; System.arraycopy(values, 0, this.values, 0, values.length);
this(checkLengths(lengths), checkValues(values, lengths), true);
  public JPEGHuffmanTable(short[] lengths, short[] values)  {    if (lengths == null || values == null || lengths.length > 16        || values.length > 256)      throw new IllegalArgumentException("invalid length or values array");    for (int i = 0; i < lengths.length; i++)      {        if (lengths[i] < 0)          throw new IllegalArgumentException("negative length");      }    for (int i = 0; i < values.length; i++)      {        if (values[i] < 0)          throw new IllegalArgumentException("negative value");      }    int sum = 0;    for (int i = 0; i < lengths.length; i++)      {        if (lengths[i] > ((1 << (i + 1)) - 1))          throw new IllegalArgumentException("invalid number of codes"                                             + " for code length " + (i + 1));        sum += lengths[i];      }    if (values.length != sum)      throw new IllegalArgumentException("invalid number of values"                                         + " for number of codes");    this.lengths = new short[lengths.length];    System.arraycopy(lengths, 0, this.lengths, 0, lengths.length);    this.values = new short[values.length];    System.arraycopy(values, 0, this.values, 0, values.length);  }