package LanQiaoOJ; import java.util.Scanner; public class 二进制中1的个数2 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); /* * 获得二进制方法还可用 * 1-BigInteger * 2-toString———返回小写——toUpperCase()--返回大写 * 3-bitCount * Integer.person*/ int count=Integer.bitCount(n); System.out.print(count); } }