Returns the green component in the range 0-255 in the default sRGB space. - Java 2D Graphics

Java examples for 2D Graphics:Color RGB

Description

Returns the green component in the range 0-255 in the default sRGB space.

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        int rgb = 2;
        System.out.println(getGreen(rgb));
    }//from   ww  w.java2  s  . com

    /**
     * Returns the green component in the range 0-255 in the default sRGB
     * space.
     * @return the green component.
     * @see #getRGB
     */
    public static int getGreen(int rgb) {
        return (rgb >> 8) & 0xFF;
    }
}

Related Tutorials