Timeline for String to Binary
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 1, 2017 at 14:50 | comment | added | Kevin Cruijssen |
I know it's been more than 2.5 year, but you can save 20 bytes like this: interface B{static void main(String[]a){for(Integer i=0;i<a[0].length();)System.out.print(i.toString(a[0].charAt(i++),2)+" ");}}
|
|
Jan 23, 2015 at 15:33 | comment | added | Rodolfo Dias |
You can get rid of the public and shorten the program name to a single char to win more bytes. Plus, (String[]a) is perfectly accepted by the compiler, earning you another byte.
|
|
Jan 23, 2015 at 15:27 | history | edited | Bryan Devaney | CC BY-SA 3.0 |
corrected to include full file, as requested.
|
Jan 23, 2015 at 15:23 | comment | added | Bryan Devaney | nice, I would never have thought of that. thank you. | |
Jan 23, 2015 at 15:00 | comment | added | njzk2 |
could be shorter using for(char c:a[0].toCharArray()){ or even for(byte b:a[0].getBytes()){ since the input is ascii, assuming a non-utf-16 machine locale
|
|
Jan 23, 2015 at 13:19 | comment | added | Rodolfo Dias | The full program includes the main class, too. | |
Jan 23, 2015 at 13:10 | comment | added | Bryan Devaney | that is the full program, if you put that in a main class, it will run. as for better golfing, probably but i could not spot how. | |
Jan 23, 2015 at 11:56 | review | Low quality posts | |||
Jan 23, 2015 at 12:32 | |||||
Jan 23, 2015 at 11:47 | comment | added | Rodolfo Dias | I think OP wants a full program, not just a snippet. Plus, it can be golfed a lot more, methinks. | |
Jan 23, 2015 at 11:41 | review | First posts | |||
Jan 23, 2015 at 12:20 | |||||
Jan 23, 2015 at 11:39 | history | answered | Bryan Devaney | CC BY-SA 3.0 |