Increment a number without using ++ or + | Java program to increment an unsigned int using bitwise operators . ; function that increment the value . ; Invert bits and apply negative sign ; Driver code
import java . io . * ; class GFG { static long increment ( long i ) { i = - ( ~ i ) ; return i ; } public static void main ( String [ ] args ) { long n = 3 ; System . out . print ( increment ( n ) ) ; } }