Here you can find the source of encode(Color c)
public static String encode(Color c)
//package com.java2s; //License from project: Open Source License import java.awt.Color; public class Main { public static String encode(Color c) { return "#" + hex(c.getAlpha(), 2) + hex(c.getRed(), 2) + hex(c.getGreen(), 2) + hex(c.getBlue(), 2); }//w ww .j a v a 2 s.co m public static String hex(int i, int places) { String s = Integer.toHexString(i); while (s.length() < places) s = "0" + s; return s; } }