Optimize JNI and add particle filtering API