Java port of https://github.com/iAnatoly/multiplication