protected int[] readColorTable(int ncolors){
  int nbytes=3 * ncolors;
  int[] tab=null;
  byte[] c=new byte[nbytes];
  int n=0;
  try {
    n=in.read(c);
  }
 catch (  IOException e) {
  }
  if (n < nbytes) {
    status=STATUS_FORMAT_ERROR;
  }
 else {
    tab=new int[256];
    int i=0;
    int j=0;
    while (i < ncolors) {
      int r=((int)c[j++]) & 0xff;
      int g=((int)c[j++]) & 0xff;
      int b=((int)c[j++]) & 0xff;
      tab[i++]=0xff000000 | (r << 16) | (g << 8)| b;
    }
  }
  return tab;
}

protected int [ ] readColorTable ( int ncolors ) { int nbytes = 3 * ncolors ; int [ ] tab = null ; byte [ ] c = new byte [ nbytes ] ; int n = 0 ; try { n = in . read ( c ) ; } catch ( IOException e ) { } if ( n < nbytes ) { status = STATUS_FORMAT_ERROR ; } else { tab = new int [ 256 ] ; int i = 0 ; int j = 0 ; while ( i < ncolors ) { int r = ( ( int ) c [ j ++ ] ) & 0xff ; int g = ( ( int ) c [ j ++ ] ) & 0xff ; int b = ( ( int ) c [ j ++ ] ) & 0xff ; tab [ i ++ ] = 0xff000000 | ( r << 16 ) | ( g << 8 ) | b ; } } return tab ; }
reads color table as 256 rgb integer values
