Java examples for 2D Graphics:Color HEX
get Hex For Color
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { int c = 2; System.out.println(getHexForColor(c)); }//w w w .j ava 2 s.com public static String getHexForColor(int c) { return "#" + Integer.toHexString((c & 0xffffff) | 0x1000000) .substring(1); } }