Long.numberOfTrailingZeros(long i) has the following syntax.
public static int numberOfTrailingZeros(long i)
In the following code shows how to use Long.numberOfTrailingZeros(long i) method.
/*from w ww . j a va2s . co m*/ 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.