Here you can find the source of colorToHexString(int color)
public static String colorToHexString(int color)
//package com.java2s; public class Main { public static String colorToHexString(int color) { return String.format("#%06X", 0xFFFFFFFF & color); }// ww w . j a v a2 s .c om }