ee.Number.bitwiseAnd
Calculates the bitwise AND of the input values.
Usage | Returns |
---|
Number.bitwiseAnd(right) | Number |
Argument | Type | Details |
---|
this: left | Number | The left-hand value. |
right | Number | The right-hand value. |
Examples
/**
* 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
"""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())
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["This function calculates the bitwise AND of two numbers, `left` and `right`."],["The result is a new number where each bit is 1 only if the corresponding bits in both input numbers are 1."],["It's useful for manipulating binary representations of numbers, like extracting specific bits or applying masks."],["The example demonstrates how the function works with unsigned 8-bit numbers, calculating the bitwise AND of 25 and 21."],["You can use this function in both JavaScript and Python within the Google Earth Engine environment."]]],["The `bitwiseAnd` method computes the bitwise AND between two numbers. It takes a `right` number as input and operates on a `left` number (this). The function returns a number representing the result of the AND operation. For example, the bitwise AND of 25 and 21 yields 17, demonstrated by their binary representations: `00011001` AND `00010101` results in `00010001`. The function is available in JavaScript and Python APIs.\n"]]