Binary converts text into 8-bit binary.
Give it some text, and it turns each character into a sequence of 0s and 1s.
Give it binary, and it turns it back into text.
Text.
Binary.
Text again.
That's it.
No dependencies. No UI. Just bytes.
Convert text:
$ java -cp target/classes io.javalabs.Main hello
01101000 01100101 01101100 01101100 01101111
Run it the other way:
$ java -cp target/classes io.javalabs.Main "01101000 01100101 01101100 01101100 01101111"
hello
And maybe:
$ java -cp target/classes io.javalabs.Main Java
01001010 01100001 01110110 01100001
Binary goes in.
Text comes out.
Or text goes in.
Binary comes out.
- Run Binary with some text or binary.
- Binary checks the input.
- Text is converted into 8-bit binary.
- Binary is converted back into characters.
- That's the whole thing. 🔢
- Java 21
StringInteger- CLI
Compile:
mvn clean compileConvert text to binary:
java -cp target/classes io.javalabs.Main helloConvert binary to text:
java -cp target/classes io.javalabs.Main "01101000 01100101 01101100 01101100 01101111"Binary is one of those simple ideas that sits underneath almost everything we use.
This is a tiny experiment for turning characters into bits and back again.
Write some text.
Turn it into binary.
Turn it back. 🔢
Part of JavaLabs.io - a collection of small Java experiments built to turn random ideas into working code.