Here you can find the source of toHex(Color color)
public static int toHex(Color color)
//package com.java2s; /**//from w ww .j av a 2 s. c o m * This class is part of the Gadomancy Mod * Gadomancy is Open Source and distributed under the * GNU LESSER GENERAL PUBLIC LICENSE * for more read the LICENSE file * * Created by makeo @ 13.07.2015 03:50 */ import java.awt.*; public class Main { public static int toHex(int red, int green, int blue) { return (red << 16) | (green << 8) | (blue); } public static int toHex(Color color) { return toHex(color.getRed(), color.getGreen(), color.getBlue()); } }