代码还可以更加优化
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner s = new Scanner(System.in);
long data = s.nextLong();
if(data <= 0){
System.out.println(-1);
}
long m = 0;
int count = 0;
while(data > 0){
m = data % 2;
if(m == 1){
System.out.println(count);
break;
}
data /= 2;
count++;
}
s.close();
}
}