get Red From RGB - Java 2D Graphics

Java examples for 2D Graphics:Color RGB

Description

get Red From RGB

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        int binaryColour = 2;
        System.out.println(getRedFromRGB(binaryColour));
    }//from w  ww  .java2 s .c o m

    public static int getRedFromRGB(int binaryColour) {
        return (binaryColour & 0x00ff0000) >> 16;
    }
}

Related Tutorials