Flipping Bits

Problem Statement

You will be given a list of 32 bits unsigned integers. You are required to output the list of the unsigned integers you get by flipping bits in its binary representation (i.e. unset bits must be set, and set bits must be unset).

Input Format

The first line of the input contains the list size , which is followed by lines, each line having an integer from the list.

Constraints

Output Format

Output one line per element from the list with the requested result.

Sample Input

3
2147483647
1
0

Sample Output

2147483648
4294967294
4294967295

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.util.Scanner;

public class Solution {

    public static void main(String[] args) {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long max = (long)(Math.pow(2, 32)-1);
        for(int i=0;i<N;i++)
            {
            long k = sc.nextLong();
             
         
         System.out.println(k^max);
        }
    }
}

Interview Questions: 

Search