Languages

How to convert binary String to int in java?

14 points
Asked by:
Marcin
2477

For example when I have:

//                      binary str // int
String binaryString1 = "00000101"; // -> 5
String binaryString2 = "00001000"; // -> 8
String binaryString3 = "11111111"; // -> 255

What is the best way I can convert those numbers to integer in java?

0 answers
Hey 👋
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.