java mask int to positive

Solutions on MaxInterview for java mask int to positive by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "java mask int to positive"
Caprice
11 Jan 2021
1int abs(int v) {
2    int mask = v >> Integer.SIZE - 1;
3
4    return v + mask ^ mask;
5}
6
similar questions
queries leading to this page
java mask int to positive