Java ByteBuffer to Hex toHex(ByteBuffer bb)

Here you can find the source of toHex(ByteBuffer bb)

Description

to Hex

License

LGPL

Declaration

public static StringBuffer toHex(ByteBuffer bb) 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.nio.ByteBuffer;

public class Main {
    public static StringBuffer toHex(ByteBuffer bb) {
        StringBuffer sb = new StringBuffer();
        // bb = bb.duplicate();
        for (int i = 0; i < bb.limit(); i++) {
            sb.append(Integer.toString((bb.get(i) & 0xff) + 0x100, 16).substring(1));
        }//from   w ww .ja va2  s.  c om
        return sb;
    }
}

Related

  1. asHexString(StringBuilder temp, ByteBuffer buffer)
  2. byteBufferToHex(ByteBuffer buffer)
  3. bytesToHex(ByteBuffer bytes)
  4. bytesToHex(ByteBuffer bytes)
  5. bytesToHexString(ByteBuffer b)
  6. toHex(ByteBuffer bb)
  7. toHex(ByteBuffer buf)
  8. toHex(ByteBuffer buffer)
  9. toHex(ByteBuffer data)