Java Hex Calculate toHexString(int i)

Here you can find the source of toHexString(int i)

Description

convert an integer to a 2-digit hex string.

License

Open Source License

Parameter

Parameter Description
i the integer

Return

the string

Declaration

public static String toHexString(int i) 

Method Source Code

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

public class Main {
    /**/*  ww w.  ja  v  a  2 s. c  o  m*/
     * convert an integer to a 2-digit hex string.
     * 
     * @param i
     *            the integer
     * @return the string
     */
    public static String toHexString(int i) {
        String s = Integer.toHexString(i);
        while (s.length() < 2) {
            s = "0" + s;
        }
        return s;
    }
}

Related

  1. toHexString(int b)
  2. toHexString(int bits, int value)
  3. toHexString(int decimal, int stringLength)
  4. toHexString(int decimal, int stringLength)
  5. toHexString(int i)
  6. toHexString(int i)
  7. toHexString(int i)
  8. toHexString(int i)
  9. toHexString(int i)