Here you can find the source of HTMLToTriplet(String color)
private static byte[] HTMLToTriplet(String color)
//package com.java2s; public class Main { private static byte[] HTMLToTriplet(String color) { final int offset = color.charAt(0) == '#' ? 1 : 0; final short red = Short.parseShort(color.substring(offset + 0, offset + 2), 16); //red final short green = Short.parseShort(color.substring(offset + 2, offset + 4), 16); //green final short blue = Short.parseShort(color.substring(offset + 4, offset + 6), 16); //blue final byte r = (byte) (red & 0xff); final byte g = (byte) (green & 0xff); final byte b = (byte) (blue & 0xff); return new byte[] { r, g, b }; }/*ww w . j a va 2 s . c om*/ }