Java Hex Calculate toHex(byte b)

Here you can find the source of toHex(byte b)

Description

to Hex

License

Apache License

Declaration

public static String toHex(byte b) 

Method Source Code

//package com.java2s;
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *

public class Main {
    final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();

    public static String toHex(byte b) {
        char[] c = new char[2];
        int v = b & 0xFF;
        c[0] = hexArray[v >>> 4];
        c[1] = hexArray[v & 0x0F];//from  ww w . ja  v a  2  s  .  c o m
        return new String(c);
    }
}

Related

  1. toHex(byte b)
  2. toHex(byte b)
  3. tohex(byte b)
  4. toHex(byte b)
  5. toHex(byte b)
  6. toHex(byte b)
  7. toHex(byte b)
  8. toHex(byte b)
  9. toHex(byte b)