binaryToString function

String binaryToString(
  1. int n
)

二进制转String

Implementation

String binaryToString(int n) {
  StringBuffer textBuffer = StringBuffer();
  try {
    for (int i = 31; i >= 0; i--) {
      textBuffer.write(n >> i & 1);
    }
  } catch (e) {
    print('binary to string is failed');
  }
  return textBuffer.toString();
}