ee.Number.bitwiseAnd

  • The bitwise AND operation calculates the bitwise AND of the input number values.

  • The Number.bitwiseAnd(right) method returns a Number.

  • The method takes two arguments: this (the left-hand value) and right (the right-hand value), both of type Number.

  • Examples show how to use the bitwiseAnd method in both JavaScript and Python, demonstrating the bitwise AND calculation with unsigned 8-bit binary numbers.

Calculates the bitwise AND of the input values.

UsageReturns
Number.bitwiseAnd(right)Number
ArgumentTypeDetails
this: leftNumberThe left-hand value.
rightNumberThe right-hand value.

Examples

Code Editor (JavaScript)

/**
 * Unsigned 8-bit type example.
 *
 * 25 as binary:   00011001
 * 21 as binary:   00010101
 * Both digits 1?: 00010001
 *
 * 00010001 is unsigned 8-bit binary for 17.
 */

print(ee.Number(25).bitwiseAnd(21));

Python setup

See the Python Environment page for information on the Python API and using geemap for interactive development.

import ee
import geemap.core as geemap

Colab (Python)

"""Unsigned 8-bit type example.

25 as binary:   00011001
21 as binary:   00010101
Both digits 1?: 00010001

00010001 is unsigned 8-bit binary for 17.
"""

print(ee.Number(25).bitwiseAnd(21).getInfo())