public static String encode(Color color) { StringBuffer buffer = new StringBuffer("#"); if (color.getRed() < 16) { buffer.append('0');
public static String encode(String string) { int n = string.length(); char character; StringBuffer buffer = new StringBuffer();  for (int i = 0; i < n; i++) { character = string.charAt(i);  try { buffer.append(htmlCode[character]); } catch(ArrayIndexOutOfBoundsException aioobe) { buffer.append(character); }
    public static String encode(Color color) {        StringBuffer buffer = new StringBuffer("#");        if (color.getRed() < 16) {            buffer.append('0');        }        buffer.append(Integer.toString(color.getRed(), 16));        if (color.getGreen() < 16) {            buffer.append('0');        }        buffer.append(Integer.toString(color.getGreen(), 16));        if (color.getBlue() < 16) {            buffer.append('0');        }        buffer.append(Integer.toString(color.getBlue(), 16));        return buffer.toString();    }