Binary Representation of an Integer

Implemented in Ruby and Java

Panos Matsinopoulos
Level Up Coding
Published in
4 min readJun 27, 2023

--

Image by Gipfelsturm69 from Pixabay

There will be many times in which you would like to convert an integer into its binary representation.

For example, the number 2 has the binary equivalent 10. Or the number 4 is the binary number 100. Or the number 47 is the binary 101111.

--

--