For every set bit of a number toggle bits of other | A Java program toggle bits of n2 that are at same position as set bits of n1 . ; function for the Nega_bit ; Driver program
import java . io . * ; class GFG { static int toggleBits ( int n1 , int n2 ) { return ( n1 ^ n2 ) ; } public static void main ( String args [ ] ) { int n1 = 2 , n2 = 5 ; System . out . println ( toggleBits ( n1 , n2 ) ) ; } }