java round double or float to nearest wholenumber code example Example: double round java integer int a = (int) Math.round(doubleVar);