finished java matrix math