Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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