added MCMC java code; fixed some bugs in MCMC R code