Java implementation of Mangle