binary()

本参考资料用于Processing 3.0+。 如果你使用的是前一版本,请在使用软件帮助菜单内的参考资料。. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

名称

binary()

示例
 color c = color(255, 204, 0);

println(c);



   //Prints "-13312"
println(binary(c));


// Prints "11111111111111111100110000000000"
println(binary(c, 16));

// Prints "1100110000000000"  
描述 Converts an int, byte, char, or color to a String containing the equivalent binary notation. For example, the color value produced by color(0, 102, 153, 255) will convert to the String value “11111111000000000110011010011001”. This function can help make your geeky debugging sessions much happier.

Note that the maximum number of digits is 32, because an int value can only represent up to 32 bits. Specifying more than 32 digits will have no effect.

语法
binary(value) binary(value, digits)
参数
value char, byte, or int: value to convert
digits int: number of digits to return
返回值 String
相关 unbinary()
hex()
unhex()

Updated on October 2, 2018 05:02:08pm EDT

binary()