Java port of https://github.com/kpu/mtplz