Java Binary to Hex binToHex(String bin)

Here you can find the source of binToHex(String bin)

Description

bin To Hex

License

Open Source License

Declaration

public static String binToHex(String bin) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String binToHex(String bin) {
        String result = "";
        int decimal;
        for (int i = 4; (i <= 64 && i <= bin.length()); i = i + 4) {
            decimal = Integer.parseInt(bin.substring((i - 4), i), 2);
            result = result.concat(Integer.toString(decimal, 16)).toUpperCase();
        }//from   w w w  . ja  va2 s.  c  o  m

        return result;
    }
}

Related

  1. BinaryToHexString(byte[] bytes)
  2. binaryToHexString(String binaryValue)
  3. binToHex(byte[] bin)
  4. binToHex(byte[] bytes)
  5. binToHex(byte[] data)
  6. binToHex(String sBinString)
  7. binToHexString(byte[] bytes)