I need to get the byte array from file path to upload the image. But the byte array in the form of array.How do i get the byte array. I have followed the following steps but could not found the solutions.
I have tried the following code but does not work.
byte []buffer=new byte[1024];
ByteArrayOutputStream os=new ByteArrayOutputStream();
FileInputStream fis=new FileInputStream(f);
int read;
while ((read=fis.read(buffer))!=-1){
os.write(buffer,0,read);
}
fis.close();
os.close();
It return the byte array object but i need the array. When i used Array.toString(bytearray) it return in the string form but i need the array form. Please help me how can i do this.