Created
August 5, 2012 19:10
-
-
Save volgar1x/3266725 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 println(String string, int radix) { | |
byte[] bytes = string.getBytes(); | |
for (byte b : bytes) { | |
System.out.print(Integer.toString(b, radix)); | |
} | |
System.out.println(); | |
} | |
public static void printlnBinary(String string) { | |
println(string, 2); | |
} | |
// usage: | |
String message = "Hello World!"; | |
printlnBinary(message); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment