class Solution {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
int n=scanner.nextInt();
System.out.println(NumberOf1(n));
}
static public int NumberOf1(int n)
{
return Integer.bitCount(n);
}
}
调用系统函数, 也算是练习算法吗?