I'm trying to do a code review for our project using FindBugs.
we have a method to generate unique id (randomly) :
public static String generateUUID(int base){
return String.valueOf(getCurrentTimeInNanos((long)base)) +
String.valueOf(Math.abs(random.nextInt()));
}
and findBugs indicates RV_ABSOLUTE_VALUE_OF_RANDOM_INT
warning (RV: Bad attempt to compute absolute value of signed 32-bit random integer ) , i guess the problem is in String.valueOf(Math.abs(random.nextInt())
.
Does anyone have an explanation for why is this and how to fix it ?