I’m recently facing the below problem
public class Main { public static void main(String[] args) throws Exception { // Your code here! int i = -2147483648; int j = i * -1; System.out.println("j="+j); } } Result : -2147483648
Online IDE with code : https://paiza.io/projects/e/17lF_6-GltIcyubZv3QoFg?theme=twilight
But how it’s works as per the logic I need to get 2147483648 is a result right? Then how I got this negative number ? It’s because of integer range (Integer.MIN_VALUE)? how to fix this issue?