Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

public class Main {
    final public static String argbColorToHex(int alpha, int red, int green, int blue) {
        StringBuilder builder = new StringBuilder();
        builder.append(encodeToHex(alpha));
        builder.append(encodeToHex(red));
        builder.append(encodeToHex(green));
        builder.append(encodeToHex(blue));
        return builder.toString();
    }

    final public static String encodeToHex(int color) {
        StringBuilder builder = new StringBuilder();
        if ((color & 0xFF) < 0x10) {
            builder.append("0");
        }
        builder.append(Long.toHexString(color));
        return builder.toString();
    }
}