Here you can find the source of encodeColor(int r, int g, int b)
public static String encodeColor(int r, int g, int b)
//package com.java2s; //License from project: Open Source License import java.awt.Color; public class Main { public static String encodeColor(Color color) { if (null == color) { return "0x000000"; }//from w w w .j a v a2 s. co m return "0x" + String.format("%02x%02x%02x", color.getRed(), color.getGreen(), color.getBlue()).toUpperCase(); } public static String encodeColor(int r, int g, int b) { return "0x" + String.format("%02x%02x%02x", r, g, b).toUpperCase(); } }