HW4.46

时间:2022-03-29 15:02:58

HW4.46

 import java.util.Scanner;

 public class Solution
 {
     public static void main(String[] args)
     {
         Scanner input = new Scanner(System.in);

         System.out.print("Enter an integer: ");
         int number = input.nextInt();

         int mask = 1;

         for(int i = 15; i > 0; i--)
         {
             int a = number >> i;
             int b = a & mask;
             System.out.print(b);
         }

         System.out.println();
     }
 }

相关文章