how to free memory of byte array...
code
for(int j=0;j<count;j++){
buffer=null; //free the memory by set as a null but not working????? shows array index out of bound exception for the second time
buffer= new byte[size]; //byte mem alloc
temp2=di.read(buffer,total,size);// read buffer
total=total+temp2;
fo=null;
ds=null;
fo= new FileOutputStream(flist[j]);
ds= new DataOutputStream(fo);
ds.write(buffer,0,size);
System.out.println("write: "+(j+1));
fo.close();
ds.close();
}
exception occur at run time...
Exception in thread "main" java.lang.IndexOutOfBoundsException
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(Unknown Source)
at java.io.DataInputStream.read(Unknown Source)
at filesplitandjoin.main(filesplitandjoin.java:57)
src code attached:(