toBinary function
Implementation
String toBinary(int num, [int len = 8]) {
StringBuffer buf = StringBuffer();
if (len < 0) throw ArgumentError('len() should >=0');
while (--len >= 0) {
buf.write((num & (0x1 << len)) > 0 ? '1' : '0');
}
return buf.toString();
}