Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String intToHexString_4(int a) {
        StringBuilder stringBuilder = new StringBuilder("");
        int v = a & 0xFFFF;
        String hv = Integer.toHexString(v);
        if (hv.length() == 1) {
            stringBuilder.append("000");
        } else if (hv.length() == 2) {
            stringBuilder.append("00");
        } else {
            stringBuilder.append("0");
        }
        stringBuilder.append(hv);
        return stringBuilder.toString();
    }
}