code: public final int getIndexNearest(int pRed, int pGreen, int pBlue) {
          // NOTE: the third line in expression for blue is shifting DOWN not UP.
          return inverseRGB[((pRed << (2 * QUANTBITS - TRUNCBITS)) & QUANTMASK_RED) +
                  ((pGreen << (/* 1 * */ QUANTBITS - TRUNCBITS)) & QUANTMASK_GREEN) +
                  ((pBlue >> (TRUNCBITS)) & QUANTMASK_BLUE)] & 0xFF;
      }
docs: Gets the index of the nearest color to from the color map.
  
  @param pRed red component of the color to get the nearest color to from color map
  @param pGreen green component of the color to get the nearest color to from color map
  @param pBlue blue component of the color to get the nearest color to from color map
  @return index of color which closest matches input color by using the
  created inverse color map.