java function that changes negative number to 0 April 12, 2024 by Tarik You should use : Math.max(0, yourVar) You don’t need a built-in function for that.