I am trying to convert Linked List to Array in Java as shown in the code below
import java.io.*;
import java.util.*;
public class LinkedLst
{
public static void main(String[] args) throws IOException
{
FileInputStream fis = new FileInputStream("input");
LinkedList<Integer> ll = new <Integer>LinkedList();
int c;
while((c = fis.read())!=-1)
ll.add(new Integer(c));
Integer[] arr = ll.toArray(new Integer[ll.size()]);
System.out.println(arr);
fis.close();
}
}
with input file as follows
12
13
14
15
16
I am able to compile but I end up with the following error while running
[Ljava.lang.Integer;@2098746b
Could anybody help me with this code ?