int getPaletteIndex(int rgb) 
      {   
        ColorRecord rec;
    
        for ( int itable = rgb % hTable.length; 
              (rec = hTable[itable]) != null && rec.rgb != rgb;
              itable = ++itable % hTable.length
            ) 
          ;
    
        if (rec != null)
          return rec.ipalette;
          
        return -1;  
      }