Java Integer to Hex intToHexString(int val, int width)

Here you can find the source of intToHexString(int val, int width)

Description

int To Hex String

License

Open Source License

Declaration

public static String intToHexString(int val, int width) 

Method Source Code

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

public class Main {
    static String mZeroes = "00000000000000000000000000000000";

    public static String intToHexString(int val, int width) {
        String str = Integer.toHexString(val);
        if (str.length() >= width) {
            return str;
        }/*www  .  jav a  2  s  .com*/
        return mZeroes.substring(0, width - str.length()) + str;
    }
}

Related

  1. intToHexString(int i)
  2. intToHexString(int i)
  3. intToHexString(int i)
  4. intToHexString(int num)
  5. intToHexString(int number)
  6. intToHexString(int value)
  7. intToHexString(int value, int digits)
  8. intToHexWithPadding(Integer input, Integer max_size)