Java tutorial
//package com.java2s; // FPlayAndroid is distributed under the FreeBSD License public class Main { public static String toHexColor(int rgb) { final String s = "00000" + Integer.toHexString(rgb); return "#" + s.substring(s.length() - 6); } }