Here you can find the source of covertToHtmlColor(Color color)
public static String covertToHtmlColor(Color color)
//package com.java2s; import java.awt.Color; public class Main { public static String covertToHtmlColor(Color color) { return color == null ? null : "#" + to2BitHexString(color.getRed()) + to2BitHexString(color.getGreen()) + to2BitHexString(color.getBlue()); }/*from w w w . j av a2 s . com*/ private static String to2BitHexString(int i) { String ret = Integer.toHexString(i); if (ret.length() < 2) { ret = "0" + ret; } return ret; } }