Java Integer .numberOfTrailingZeros ( int i)

Syntax

Integer.numberOfTrailingZeros(int i) has the following syntax.

public static int numberOfTrailingZeros(int i)

Example

In the following code shows how to use Integer.numberOfTrailingZeros(int i) method.


public class Main {
  public static void main(String args[]) {
    int n = 170; // 10101010
/*  ww w . j a  v a  2s  .  co  m*/
    System.out.println("Value in binary: 10101010");
    System.out.println("Number of trailing zeros : " + Integer.numberOfTrailingZeros(n));
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable