Here you can find the source of RGBtoHex(int r, int g, int b)
public static String RGBtoHex(int r, int g, int b)
//package com.java2s; //License from project: Open Source License public class Main { public static String RGBtoHex(int r, int g, int b) { String val = Integer.toHexString(r << 16 | g << 8 | b); while (val.length() < 6) val = "0" + val; return val; }//from ww w . j a va 2 s. c om }