I have this implementation of an array handler where it takes an array and adds a new value of the array.
at the moment I have it working for long type.
I want it to work for any type, if that is possible.
current implementation :
public class ArrayHandler
{
public static long[] add(long[] arr, long value)
{
long[] newarr = new long[arr.length+1];
if(arr.length == 0)
{
newarr[0] = value;
}
else
{
for(int i = 0 ; i < arr.length ; i++)
{
newarr[i] = arr[i];
}
}
newarr[arr.length] = value;
return newarr;
}
}