simple java conversion logic