Added Java version of zero and non-zero copy