Java Long .numberOfTrailingZeros ( long i)
Syntax
Long.numberOfTrailingZeros(long i) has the following syntax.
public static int numberOfTrailingZeros(long i)
Example
In the following code shows how to use Long.numberOfTrailingZeros(long i) method.
/*from w w w. j a va 2 s. c om*/
public class Main {
public static void main(String[] args) {
long l = 100;
System.out.println("Number = " + l);
System.out.println("Binary = " + Long.toBinaryString(l));
System.out.println("Lowest one bit = " + Long.lowestOneBit(l));
System.out.print("Number of leading zeros = ");
System.out.println(Long.numberOfLeadingZeros(l));
System.out.print("Number of trailing zeros = ");
System.out.println(Long.numberOfTrailingZeros(l));
}
}
The code above generates the following result.