Convert 24-bit image RGB to 4-bit 16-color
===

I am able with an `BufferedImage` to obtain the RGB values for every pixel of a 640x640 image, the output looks like this:

    [...]
    Pixel :(640, 634) RGB: 166 94 82
    Pixel :(640, 635) RGB: 166 94 80
    Pixel :(640, 636) RGB: 163 91 77
    Pixel :(640, 637) RGB: 157 88 73
    Pixel :(640, 638) RGB: 157 88 73
    Pixel :(640, 639) RGB: 159 90 74
    Pixel :(640, 640) RGB: 158 89 73
    This image has 69197 colors.

I need to classify each of the RGB colors obtained this way into 3-bit RGB (8 colors), I would need to have an idea on how to do this... How to know the range of RGB for each of the 8 colors of the 3-bit RGB. Thanks!