completed matrices.java