Here you can find the source of encode(Color color)
public static String encode(Color color)
//package com.java2s; //License from project: Open Source License import java.awt.Color; public class Main { public static String encode(Color color) { if (color == null) { return null; }/* w w w .j av a2s .c om*/ int r = color.getRed(); int g = color.getGreen(); int b = color.getBlue(); int a = color.getAlpha(); return String.format("0x%02x%02x%02x%02x", r, g, b, a); } }