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: 
Try it like this:

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

// populate array

// writing array to disk
FileOutputStream f_out = new FileOutputStream("C:\myarray.data");
ObjectOutputStream obj_out = new ObjectOutputStream (f_out);
obj_out.writeObject(array);

// reading array from disk
FileInputStream f_in = new FileInputStream("C:\myarray.data");
ObjectInputStream obj_in = new ObjectInputStream (f_in);
Shape[] tmp_array = (Shape[])obj_in.readObject();

```
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.