how can i get result in java using recursive
function