Extracts the red component from color . - Java 2D Graphics

Java examples for 2D Graphics:Color RGB

Description

Extracts the red component from color .

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        int color = 2;
        System.out.println(red(color));
    }//w  w  w  .  ja va  2 s. c  o  m

    /**
     * Extracts the red component from {@code color}.
     */
    public static int red(int color) {
        return color & 0xff;
    }
}

Related Tutorials