Java ASCII to Hex ASCIIToHex(int args, int len)

Here you can find the source of ASCIIToHex(int args, int len)

Description

ASCII To Hex

License

Apache License

Parameter

Parameter Description
args a parameter
len a parameter

Declaration

public static String ASCIIToHex(int args, int len) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**//  w w w . ja va 2 s . co m
     * 
     * @param args
     *            
     * @param len
     *            
     * @return
     */
    public static String ASCIIToHex(int args, int len) {
        String str = Integer.toHexString(args);
        if (str.length() < len) {
            while (str.length() < len) {
                if (str.length() == len) {
                    return str;
                }
                str = "0" + str;
            }
        }

        return str.toUpperCase();
    }
}

Related

  1. ascii2Hex(byte[] in)
  2. Ascii2Hex(int len, byte data_in[], byte data_out[])
  3. asciiToHex(byte[] src, int len, int padding)
  4. asciiToHex(String ascii)
  5. asciiToHex(String ascii)
  6. asciiToHex(String ascii)
  7. asciiToHex(String asciiValue)