首页 > 文档 > binary()二进制转换
2017
07-20

binary()二进制转换

Name

binary()二进制转换

   

Examples

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

println(c); // Prints “-13312”

println(binary(c)); // Prints “11111111111111111100110000000000”

println(binary(c, 16)); // Prints “1100110000000000”

Description

Converts an intbytechar, 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.

int、字节、char 或颜色转换为包含等效二进制符号的字符串。例如, 颜色产生的颜色值 (0102153255) 将转换为字符串值 “11111111000000000110011010011001”。此功能有助于使您的书调试会话更快乐。

 

请注意, 最大位数是 32, 因为 int 值最多只能表示32位。指定32位以上的数字将不起作用。

Syntax

binary(value)

binary(value, digits)

Parameters

value

char, byte, or int: value to convert

 

要转换的值

digits

int: number of digits to return

要返回的位数

Returns

String

Related

unbinary()
hex()
unhex()



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。