@Override
    public boolean save(float[][] quad, int size, String outputFile) {
        ByteBuffer buffer = ByteBuffer.allocate(4 * size * size + 4);
        buffer.putInt(size);
        for (int i = 0; i < size; i++) {
            for (int j = 0; j < size; j++) {
                buffer.putFloat(quad[i][j]);
            }
        }
        buffer.rewind();

        FileChannel fc = null;
        try {
            fc = new FileOutputStream(outputFile).getChannel();
            while (buffer.hasRemaining()) {
                fc.write(buffer);
            }
            fc.force(true);

            fc.close();
        } catch (FileNotFoundException e) {
            return false;
        } catch (IOException e) {
            return false;
        }

        return true;
    }