import java.util.Scanner;
class BitRepresent
{
public static void main(String args[])
{
Scanner input=new Scanner(System.in);
int counter=0;
System.out.println("Enter the number:");
int n=input.nextInt();
while(n!=0)
{
n=n/2;
counter++;
}
System.out.println("No. of Bit="+counter);
}
}Added (24 February 14, 6:00 PM)
---------------------------------------------
Thanks to all for viewing ,if any comment ...