这题有毒,说的是byte类型的数据,我按byte接收处理数据就只能通过30%的测试用例,但是换成int就全部通过了!!!

import java.util.Scanner;

public class Test86{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int number = scanner.nextInt();
            /**
             *byte number=scanner.nextByte();
            byte[] bytes = new byte[8];
            for (int i = 0; i < 8; i++) {
                bytes[bytes.length - i - 1] = (byte) (number & 1);
                number = (byte) (number >> 1);
            }
             */

            String binaryString = Integer.toBinaryString(number);
            String[] strings = binaryString.split("0+"); //再将字符串按多个0分割
            int count = 0;
            for (String string : strings) {
                count = Math.max(count, string.length());
            }
            System.out.println(count);
        }
    }
}