Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created August 21, 2020 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/7ebbeb794f34c8db5bfe41f5ed7610ed to your computer and use it in GitHub Desktop.
Save parzibyte/7ebbeb794f34c8db5bfe41f5ed7610ed to your computer and use it in GitHub Desktop.
public static void main(String[] args) {
String originalText = "parzibyte.me";
System.out.println("Original text: " + originalText);
String translatedText = textToBinary(originalText);
System.out.println("In binary, it is: " + translatedText);
System.out.println("-----------------");
String binaryText = "1110000 1100001 1110010 1111010 1101001 1100010 1111001 1110100 1100101 101110 1101101 1100101";
System.out.println("Binary: " + binaryText);
String translatedBinary = binaryToText(binaryText);
System.out.println("In english, it is: " + translatedBinary);
String userText = "";
Scanner sc = new Scanner(System.in);
System.out.println("Type some text and I will convert it to binary:");
userText = sc.nextLine();
translatedText = textToBinary(userText);
System.out.println(translatedText);
System.out.println("Typee some text in binary and I will translate it to english: ");
userText = sc.nextLine();
translatedBinary = binaryToText(userText);
System.out.println(translatedBinary);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment