Here you can find the source of rgb2hex(int[] rgb)
static String rgb2hex(int[] rgb)
//package com.java2s; //License from project: Apache License public class Main { static String rgb2hex(int[] rgb) { return toHex(rgb[0]) + toHex(rgb[1]) + toHex(rgb[2]); }// w w w. j a va2s . co m static String rgb2hex(int r, int g, int b) { return rgb2hex(new int[] { r, g, b }); } static String toHex(int v) { v = Math.min(Math.max(v, 0), 255); return String.valueOf("0123456789abcdef".charAt(((v - v % 16) / 16))) + //$NON-NLS-1$ String.valueOf("0123456789abcdef".charAt(v % 16)); //$NON-NLS-1$ } }