Convert Binary To Hexadecimal Using Java

Here is a useful method to convert binary to hexadecimal using Java.

Related Posts Plugin for WordPress, Blogger...

11 comments

  1. Hello,
    thanks for the tipp – but for what do you need that lines?
    > byte[] data = new byte[binary.length * 2];
    and
    > boolean second = false;

    Best wishes,
    Rainer

  2. Im happy I located this blog, I couldnt locate any knowledge on this topic before. I also run a website and if you’re ever serious in a little bit of visitor writing for me please feel free to let me know, im always look for people to check out my website. Please stop by and leave a comment sometime!

  3. how could i use this method…or calling this method if i dont know the byte[] binary value at this line

    private static String convertBinary2Hexadecimal(byte[] binary) “

  4. i’m sorry
    i’m still not understand,may u give an example to call that method by passing a byte array….
    thx before

  5. I tried this
    String bin = “10010”;
    byte[] binary = bin.getBytes();
    debug(“Binary (convertBinary2Hexadecimal) = “+convertBinary2Hexadecimal(binary));

    and the result was:
    [DEBUG] Binary (convertBinary2Hexadecimal) = 3130303130

    Are you sure this is correct or am I doing something wrong?

  6. Dear All,

    Please help to make code in java for Encryption and Decryption by using DES or 3DES Algorithms.

    Best Regard,
    Thank you.

  7. @Rich: This program works as designed. But it does not do the right work!
    The output will ever be 3[0 or 1]*. So the program ist very funny but useless.

Leave a Reply

Your email address will not be published. Required fields are marked *