Added java preference api demo