Java Hex Format formatHexInt(final StringBuilder dst, final int p, int w)

Here you can find the source of formatHexInt(final StringBuilder dst, final int p, int w)

Description

format Hex Int

License

Apache License

Declaration

private static void formatHexInt(final StringBuilder dst, final int p,
            int w) 

Method Source Code

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

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

    private static void formatHexInt(final StringBuilder dst, final int p,
            int w) {
        int o = p + 7;
        while (o >= p && w != 0) {
            dst.setCharAt(o--, hexchar[w & 0xf]);
            w >>>= 4;/*from   www  . j  a  v  a2 s .co  m*/
        }
        while (o >= p) {
            dst.setCharAt(o--, '0');
        }
    }
}

Related

  1. formatHEX(byte[] btValue, int iOffset, int iLength)
  2. formatHex(double theG)
  3. formatHex(int value, int width)
  4. formatHex(Integer input)
  5. formatHexBytes(byte[] raw)
  6. formatHexReversed(String original, int length)
  7. formatHexStr(int width, String hexStr)
  8. formatHexString(final String input, final int charsPerLine)
  9. formatHexToString(byte[] bytes)