Fixed compile error and added Java wrapper method.