Home

0b101010

0b101010 is a binary literal used in several programming languages to denote a number written in base-2. The prefix 0b indicates that the digits following are to be interpreted as binary digits, rather than decimal, hex, or octal.

The sequence 101010 represents six bits: 1, 0, 1, 0, 1, 0. In decimal, this value is

In code, 0b101010 is an integer constant. Many modern languages support this syntax, including Python, JavaScript

The pattern 101010 is an alternating bit sequence. In 8-bit contexts, related patterns include 0b10101010 (0xAA)

42.
It
can
also
be
expressed
as
hexadecimal
0x2A,
and
in
ASCII
the
code
42
corresponds
to
the
asterisk
character
(*).
(ECMAScript
6
and
later),
Java,
C++,
Rust,
and
Go.
The
exact
rules
for
digits
after
the
prefix
may
vary
by
language
(such
as
allowable
digits
or
underscores
for
readability),
but
the
underlying
value
remains
the
same.
and
0b01010101
(0x55).
Such
patterns
are
commonly
used
as
bit
masks,
test
values
for
bitwise
operations,
or
simple
patterns
in
demonstrations
and
exercises
involving
binary
arithmetic.