Here you can find the source of RGBtoInt(String rgb)
public static int RGBtoInt(String rgb)
//package com.java2s; //License from project: Open Source License public class Main { public static int RGBtoInt(String rgb) { int r = Integer.parseInt(getR(rgb), 16); int g = Integer.parseInt(getG(rgb), 16); int b = Integer.parseInt(getB(rgb), 16); int clr = r; clr = clr << 8 | g;/*w w w . j a v a2s . c om*/ clr = clr << 8 | b; return clr; } public static String getR(String rgb) { if (rgb.length() < 2) return "00"; return rgb.substring(0, 2); } public static String getG(String rgb) { if (rgb.length() < 4) return "00"; return rgb.substring(2, 4); } public static String getB(String rgb) { if (rgb.length() < 6) return "00"; return rgb.substring(4, 6); } }