Java Hex String Create appendHex(StringBuilder builder, int b)

Here you can find the source of appendHex(StringBuilder builder, int b)

Description

append Hex

License

Open Source License

Declaration

@Deprecated
    public static void appendHex(StringBuilder builder, int b) 

Method Source Code

//package com.java2s;
/*/*from  w  w  w .  ja  v  a 2  s.c o  m*/
 * Copyright (c) 2007, 2009-2012, 2015 Eike Stepper (Berlin, Germany) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Eike Stepper - initial API and implementation
 */

public class Main {
    public static final char DIGITS[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e',
            'f', };

    @Deprecated
    public static void appendHex(StringBuilder builder, int b) {
        assertByte(b);
        builder.append(DIGITS[b >> 4]);
        builder.append(DIGITS[b & 0xf]);
    }

    @Deprecated
    private static void assertByte(int b) {
        if (b < 0 || b > 255) {
            throw new IllegalArgumentException("b=" + b); //$NON-NLS-1$
        }
    }
}

Related

  1. appendHex(StringBuffer sbuf, char ch)
  2. appendHex(StringBuffer stringbuffer, byte byte0)
  3. appendHex(StringBuilder bld, byte b)
  4. appendHex(StringBuilder buf, int value, int width)
  5. appendHex(StringBuilder buff, int i)
  6. appendHexByte(byte b, StringBuffer buf)
  7. appendHexByte(final StringBuilder sb, final byte b)
  8. appendHexBytes(StringBuilder builder, byte[] bytes)
  9. appendHexDumpRowPrefix(StringBuilder dump, int row, int rowStartIndex)