New java with conditional check