added main converter func for java