Here you can find the source of int2HexString(StringBuilder buf, int value)
Parameter | Description |
---|---|
buf | a parameter |
value | a parameter |
private static void int2HexString(StringBuilder buf, int value)
//package com.java2s; /*/* ww w.j a v a2 s .c om*/ * $Id$ * * Copyright (C) 2003-2015 JNode.org * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; If not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ public class Main { /** * This method avoids the use on Integer.toHexString, since this class may be used * during the boot-phase when the Integer class in not yet initialized. * * @param buf * @param value */ private static void int2HexString(StringBuilder buf, int value) { int rem = value & 0x0F; int q = value >>> 4; if (q != 0) { int2HexString(buf, q); } if (rem < 10) { buf.append((char) ('0' + rem)); } else { buf.append((char) ('A' + rem - 10)); } } }