Groovy web console

subscribe to the feed Subscribe
to this
site

to binary data

Published 2 months ago by Ram with tags binary
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def str = "to binary conversion"
byte[] bb = str.getBytes();
for(int i=0;i<bb.length;i++){
int dec = Integer.parseInt(Byte.toString(bb[i]));
String by = Integer.toBinaryString(dec);
System.out.print(by + " ");
}