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: 
There are lots of options for saving objects, of which native Java serialisation is one. If you don't want to use serialisation, you could look at [XStream](http://xstream.codehaus.org/), which will write POJOs out as XML.

The advantages are that it'll write out human-readable XML, and oyu don't have to implement particular interfaces for your objects. The disadvantage is that XML is relatively verbose.
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.