Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String toHex(int a, int r, int g, int b) {
        return toBrowserHexValue(a) + toBrowserHexValue(r) + toBrowserHexValue(g) + toBrowserHexValue(b);
    }

    public static String toBrowserHexValue(int number) {
        StringBuilder builder = new StringBuilder(Integer.toHexString(number & 0xff));
        while (builder.length() < 2) {
            builder.append("0");
        }
        return builder.toString().toUpperCase();
    }
}