Question: I have array of Shape:

```
Shape[] myshape = new Shape[13];

```

How I can save it to file?

I have found some code:

```
String fileName = "file.test";

BufferedOutputStream bs = null;

try {
    FileOutputStream fs = new FileOutputStream(new File(fileName));
    bs = new BufferedOutputStream(fs);
    bs.write(byte_array);
    bs.close();
    bs = null;
} catch (Exception e) {
    e.printStackTrace()
}

if (bs != null) try { bs.close(); } catch (Exception e) {}

```

But code work only for byte array, can anyone help me?

Answer: 
Or you can use serialization to save the whole object. 

Look at the javadoc:

<http://docs.oracle.com/javase/6/docs/api/java/io/Serializable.html>

And here a example from stackoverflow:

[serialization/deserialization mechanism](https://stackoverflow.com/questions/8586511/serialization-deserialization-mechanism)
You have to serialize your shapes to turn them into a byte array.
I don't think Shape implements serializable, so you'll to do that yourself.