Java tutorial
//package com.java2s; // FPlayAndroid is distributed under the FreeBSD License public class Main { public static int parseHexColor(String color) { try { if (color.charAt(0) == '#') color = color.substring(1); return 0xff000000 | (0x00ffffff & Integer.parseInt(color, 16)); } catch (Throwable ex) { return 0; } } }