十进制转换二进制
private static String convertBinary(int sum) { StringBuffer binary = new StringBuffer(); while (true) { binary.insert(0, sum % 2); sum = sum / 2; if (sum == 0 ) { break; } else if (sum == 1) { binary.insert(0, sum % 2); break; } } return binary.toString(); }
Anti-code complement the original code