GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Processing
  • Download
  • Reference
  • Environment
  • Libraries
  • Tools
  • Wiki
  • Tutorials
  • Examples
  • Books
  • Forum
  • Overview
  • People
  • Privacy

This view

  • Original page
  • New address

GeezerVison is showing processing.org — binary() / Reference

Reference+
Documentation→Reference→Data→Conversion

Name

binary()

Description

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.

Examples

  • color c = color(255, 204, 0);
    println(c);             // Prints "-13312"
    println(binary(c));     // Prints "11111111111111111100110000000000"
    println(binary(c, 16)); // Prints "1100110000000000"
    
    

Syntax

  • binary(value)
  • binary(value, digits)

Parameters

  • value(int, char)value to convert
  • digits(int)number of digits to return

Return

  • String

Related

  • unbinary()
  • hex()
  • unhex()
Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.