Get the alpha value of a 32-bit ARGB color - Java 2D Graphics

Java examples for 2D Graphics:Color RGB

Description

Get the alpha value of a 32-bit ARGB color

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        int argb = 2;
        System.out.println(getAlpha(argb));
    }/*from   ww  w.  j  a  v  a2s  .  c o  m*/

    /**
     * Get the alpha value of a 32-bit ARGB color
     * 
     * @param rgb
     * @return
     */
    public static int getAlpha(int argb) {
        return argb >> 24;
    }
}

Related Tutorials