Created
August 18, 2020 14:29
-
-
Save parzibyte/a8f9bfb045a43b9687109f304f4b1c7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
String originalText = "parzibyte.me"; | |
System.out.println("Texto original: " + originalText); | |
String translatedText = textToBinary(originalText); | |
System.out.println("Convertido a binario es: " + translatedText); | |
System.out.println("-----------------"); | |
String binaryText = "1110000 1100001 1110010 1111010 1101001 1100010 1111001 1110100 1100101 101110 1101101 1100101"; | |
System.out.println("Binario: " + binaryText); | |
String translatedBinary = binaryToText(binaryText); | |
System.out.println("Convertido a texto es: " + translatedBinary); | |
// También podemos convertir algo que el usuario proporcione | |
String userText = ""; | |
Scanner sc = new Scanner(System.in); | |
System.out.println("Ingresa algún texto y yo lo convertiré a binario: "); | |
userText = sc.nextLine(); | |
translatedText = textToBinary(userText); | |
System.out.println(translatedText); | |
System.out.println("Ingresa un texto en binario y lo convertiré a texto en español: "); | |
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