Java Integer to IntToRGB(int rgbInt)

Here you can find the source of IntToRGB(int rgbInt)

Description

Converts an RGB integer value into an array of RGB values.

License

LGPL

Parameter

Parameter Description
rgbInt RGB integer value

Return

Array containing RGB values in the format {r,g,b}

Declaration

public static int[] IntToRGB(int rgbInt) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    /**/*from  w w w .  j  av a 2s  .  c o m*/
     * Converts an RGB integer value into an array of RGB values.
     *
     * @param rgbInt RGB integer value
     * @return Array containing RGB values in the format {r,g,b}
     */
    public static int[] IntToRGB(int rgbInt) {
        int r = (int) (rgbInt / 256.0 / 256.0 % 256);
        int g = (int) (rgbInt / 256.0 % 256);
        int b = (int) (rgbInt % 256);
        return new int[] { r, g, b };
    }
}

Related

  1. intToPercent(int value)
  2. intToPlusMin(int i)
  3. intToPrefixCoded(final int val, final int shift, final char[] buffer)
  4. intToRegisters(int v)
  5. intToRGB(int color)
  6. intToRgbComponents(int rgb)
  7. intToRoman(int i)
  8. intToRoman(int value)
  9. intToScaleString(final int number, final int scale)