Java Long has an object, and like any object, it can be null. Long is a primitive type and cannot be null.
From Java 1.5 to Wards, Java supports automatic boxing and unpacking, meaning that it automatically converts between primitives and objects.
If a method returns Long , then it probably will not check for null , even if you add it to Long , however, if the method returns a Long object, it is a good idea to check for zeros.
source share