Here you can find the source of toHexByte(int i)
Parameter | Description |
---|---|
i | a parameter |
public static String toHexByte(int i)
//package com.java2s; //License from project: Apache License public class Main { /**//from w ww . j a v a2 s . c o m * Converts an integer to a 2-digit hexadecimal string. i.e. 0 -> 00, 11 -> 0b, 255 -> ff * i must fall inside 0 and 255 inclusive. * @param i * @return */ public static String toHexByte(int i) { assert (i >= 0 && i < 256); String s = Integer.toString(i, 16); if (s.length() < 2) return "0" + s; return s; } }