• + 8 comments

    Simple solution in java

    private static long complement(long num){
    
        return maxInt - num;
    
    }
    

    Where long maxInt=(long)Math.pow(2, 32)-1;