get Red from int value Color - Java 2D Graphics

Java examples for 2D Graphics:Color RGB

Description

get Red from int value Color

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        int color = 2;
        System.out.println(getRed(color));
    }// ww w.j  a  v  a2  s . c om

    public static int getRed(int color) {
        return (color >> 16) & 0xFF;
    }
}

Related Tutorials