Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.Color; import java.util.Locale; public class Main { public static final String convertToColorCode(int color) { int alpha = Color.alpha(color); int red = Color.red(color); int green = Color.green(color); int blue = Color.blue(color); return String.format(Locale.getDefault(), "%02x%02x%02x%02x", alpha, red, green, blue); } }