Here you can find the source of colorToString(int color, boolean rgb)
static public String colorToString(int color, boolean rgb)
//package com.java2s; //License from project: Open Source License public class Main { public static final int BLUE_MASK = 0xff; public static final int GREEN_MASK = 0xff00; public static final int RED_MASK = 0xff0000; public static final int GREEN_OFFSET = 8; public static final int RED_OFFSET = 16; static public String colorToString(int color, boolean rgb) { String result = null;//from w ww. java2s . c o m if (rgb) { result = "" + splitRed(color) + ", " + splitGreen(color) + ", " + splitBlue(color); } else result = "" + color; return result; } /** Split red from int. */ static public int splitRed(int colorIn) { return (colorIn & RED_MASK) >> RED_OFFSET; //red } /** Split green from int. */ static public int splitGreen(int colorIn) { return (colorIn & GREEN_MASK) >> GREEN_OFFSET; //green } /** Split blue from int. */ static public int splitBlue(int colorIn) { return colorIn & BLUE_MASK; //blue } }