I'm trying to print the values of an int
array to a local file. However, I can't seem to find a way to print the integers out in their standard form (1,2,3
) instead of a heap address: ([I@1befab0
)
My code fragment is below:
PrintWriter pr = new PrintWriter("file");
for (int i=0; i<views.length ; i++){
pr.println(Arrays.toString(views));
}
pr.close();
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("No such file exists.");
}
}
What could I be doing wrong?