color To String - Java 2D Graphics

Java examples for 2D Graphics:Color String

Description

color To String

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        int c = 2;
        System.out.println(colorToString(c));
    }/*  w ww.  ja  v  a  2s  .  co  m*/

    public static final String colorToString(int c) {
        return ("rgba=(" + ((c >> 16) & 0xff) + "," + ((c >> 8) & 0xff)
                + "," + (c & 0xff) + "," + ((c >> 24) & 0xff) + ")");
    }
}

Related Tutorials