Question: I have a jpeg, and on the end of it I wrote a zip file. 

Inside this zip file is a single txt file called `hidden.txt`. I can change the extension to zip and read the file just fine on my laptop (debian) but when I try to read it using either a `ZipInputStream` or using `ZipFile` I get an error telling me it's not a zip file.

I tried separating the jpg part out first by reading the whole thing to a `Bitmap` then writing that to a `byte[]`, however the `byte[]` encompassed more than just the image. 

My method to combine the bitmap and the zipFile (a `byte[]`)

```
private byte[] combineFiles(Bitmap drawn, byte[] zip) throws
        IOException {
    InputStream in;
    ByteArrayOutputStream out = new ByteArrayOutputStream();

    /*write the first file*/
    byte[] img;
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    drawn.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
    img = byteArrayOutputStream.toByteArray();
    in = new ByteArrayInputStream(img);
    IOUtils.copy(in, out);
    in.close();

    /*add the second (hidden) file*/
    in = new ByteArrayInputStream(zip);

    IOUtils.copy(in, out);
    out.flush();
    in.close();
    return out.toByteArray();
}

```

So really I have two questions, 

1. How do I separate the jpg and zip portions of the file?
2. How do I unzip `hidden.txt` (preferably into a `byte[]`)
	* fairly certain I know this one, but what I am doing currently does not work, probably because I am doing #1 wrong

Answer: 
You don't need to check for has next line because you have a fixed length and a try catch to handle it all. Just use the for loop but not the while loop. From there, it's just all scanner stuff:

```
for (int i = 0; i < array.length; i++)
{
    array[i] = inputStream.nextLine();        
}

```
```
int i = 0;

while (inputStream.hasNextLine() && i < array.length())
{
    array[i] = inputStream.nextLine(); 
    i++;
}    

```