Home

0b00000010

0b00000010 is a binary literal used in many programming languages to denote the numeric value formed by the bits 00000010. The 0b prefix signals that the following digits are in base 2. The eight-bit sequence 00000010 represents the decimal number 2.

In other common bases, this value is written as decimal 2 or hexadecimal 0x02. In ASCII, the

As a bit mask, 0b00000010 has only the second least-significant bit set (bit 1, if counting from

In an 8-bit unsigned integer, the value is 2. In an 8-bit signed two's-complement representation, the value

Support for binary literals such as 0b00000010 appears in several programming languages, including Python, C++14 and

See also: binary literals, bitwise operations, bit mask.

byte
00000010
corresponds
to
the
control
character
Start
of
Text
(STX).
zero).
It
is
frequently
used
with
bitwise
operations
to
test
or
set
a
specific
flag:
for
example,
value
&
0b00000010
checks
whether
that
bit
is
on,
and
value
|
0b00000010
would
enable
it.
is
also
2.
If
stored
in
a
wider
type,
the
pattern
is
typically
extended
with
leading
zeros:
16-bit
form
is
00000000
00000010.
later,
and
JavaScript
(ES6).