Java Integer to Hex intToHexLE(int val)

Here you can find the source of intToHexLE(int val)

Description

Converts an int to a little-endian hex String.

License

Open Source License

Declaration

public static String intToHexLE(int val) 

Method Source Code

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

public class Main {
    /**/*from ww w.  j av a 2 s.c om*/
     * Converts an int to a little-endian hex String.
     */
    public static String intToHexLE(int val) {
        StringBuilder buf = new StringBuilder();

        for (int i = 0; i < 32; i += 8) {
            String hex = Integer.toHexString((0xff & (val >> i)));

            if (hex.length() == 1) {
                buf.append('0');
            }

            buf.append(hex);
        }

        return buf.toString();
    }
}

Related

  1. intTohex2(int value)
  2. intToHex8(int value)
  3. intToHexBytes(int i)
  4. intToHexChar(int i)
  5. intToHexChars(int n)
  6. intToHexStr(int i, int len)
  7. intToHexStr(int src, int len, int code)
  8. IntToHexString(final int value)
  9. intToHexString(int _i)