Java: Long result = -1: cannot convert from int to long
There is no conversion between the object Long and int so you need to make it from long. Adding a L makes the integer -1 into a long (-1L): Long result = -1L; However there is a conversion from int a long so this works: long result = -1; Therefore you can write like this … Read more