@Test
public void testWriteModel() throws Exception {

    NinjaMatrix w1 = new NinjaMatrix(4, 4, true,
        1, 2, 3, 4,
        5, 6, 7, 8,
        9, 10, 11, 12,
        13, 14, 15, 16
    );
    NinjaMatrix w2 = new NinjaMatrix(2, 5, true,
        1, 2, 3, 4, 5,
        -6, -7, -8, -9, -10
    );
    Network net = new Network(w1, w2);
    StringWriter sw = new StringWriter();
    BufferedWriter bw = new BufferedWriter(sw);
    net.writeModel(bw);
    bw.close();
    Reader reader = new StringReader(sw.toString());
    Network net2 = Network.loadModel(reader);
    assertTrue(w1.isIdentical(net2.getWeightMatrix(0), 0.00001));
    assertTrue(w2.isIdentical(net2.getWeightMatrix(1), 0.00001));
}