Get Color alpha from hex - Java 2D Graphics

Java examples for 2D Graphics:Color HEX

Description

Get Color alpha from hex

Demo Code


//package com.java2s;

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

    /**Get alpha from hex*/
    public static int getAlpha(int parHex) {
        return (parHex >> 24) & 0xFF;
    }
}

Related Tutorials