I am getting the following error when executing the code below...
I am trying to convert the list of Object arrays to a BigDecimal array using the toArray() method of the List collection..
When I simply give fileFormatObj.toArray() it is working fine, but when I give like in the code below I am getting the error....
public static void main(String[] args)
{
List<BigDecimal> objList = new ArrayList<BigDecimal>();
List<Object[]> fileFormatObj = new ArrayList<Object[]>();
final Object[] array1 = new Object[1];
array1[0] = new BigDecimal(BigInteger.ONE);
fileFormatObj.add(array1);
if (fileFormatObj != null)
{
//Error here java.lang.System.arraycopy
final BigDecimal[] arr = fileFormatObj
.toArray(new BigDecimal[fileFormatObj.size()]);
objList.addAll(Arrays.asList(arr));
for (final BigDecimal object : arr) {
System.out.println("TEST-->" + object.intValue());
}
}
}