Created
August 21, 2020 18:57
-
-
Save parzibyte/fe3dd8b74deedb625586d32970308a04 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 String textToBinary(String originalText) { | |
String binaryText = ""; | |
for (int i = 0; i < originalText.length(); i++) { | |
char currentChar = originalText.charAt(i); | |
int ascii = (int) currentChar; | |
String binary = decimalToBinary(ascii); | |
binaryText += binary + " "; | |
} | |
return binaryText; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment