Here you can find the source of intToHex(int i)
Parameter | Description |
---|---|
i | Int to convert |
public static String intToHex(int i)
//package com.java2s; /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved. * This code is licensed under the GPL 2.0 license, availible at the root * application directory.//from w w w .j a v a 2 s .co m */ public class Main { /** * Utility method to convert an int into hex, padded to two characters. * handy for generating colour strings. * * @param i Int to convert * @return String a two character hex representation of i * NOTE: this is a utility method and should be put somewhere more useful. */ public static String intToHex(int i) { String prelim = Integer.toHexString(i); if (prelim.length() < 2) { prelim = "0" + prelim; } return prelim; } }