to Browser Hex Color Value - Android Graphics

Android examples for Graphics:Color Value

Description

to Browser Hex Color Value

Demo Code


//package com.java2s;

public class Main {
    public static String toBrowserHexValue(int number) {
        StringBuilder builder = new StringBuilder(
                Integer.toHexString(number & 0xff));
        while (builder.length() < 2) {
            builder.append("0");
        }/*from w ww. jav  a 2s  .  c o m*/
        return builder.toString().toUpperCase();
    }
}

Related Tutorials