The code in Integer.decode() and Long.decode() might allocate two instances of Integer/Long for the negative values less than -127:
Integer result;
result = Integer.valueOf(nm.substring(index), radix);
result = negative ? Integer.valueOf(-result.intValue()) : result;
To avoid this we can declare 'result' as int and use parseInt() method. Same for Long.
Integer result;
result = Integer.valueOf(nm.substring(index), radix);
result = negative ? Integer.valueOf(-result.intValue()) : result;
To avoid this we can declare 'result' as int and use parseInt() method. Same for Long.