Hackerrank - Flipping Bits

Problem Statement
A description of the problem can be found on Hackerrank.

Solution
Define maximum unsigned int in binary as: 11 111 111 111 111 111 111 111 111 111 111. For all input number XOR with maximum and print the output.

Aware that some programming languages have signed numbers. It is better to use integer format bigger than 32-bit.

I created solution in:

All solutions are also available on my GitHub.

Java

JavaScript

Scala

Ruby