Some java code for hdi