import java.math.BigDecimal; public class DivideByZero { public static void main(String[] args) { BigDecimal one = BigDecimal.ONE; BigDecimal x = BigDecimal.ONE; BigDecimal i = BigDecimal.ONE; while (true) { try { i = one.divide(x); System.out.println(one + " / " + x + " = " + i); } catch (ArithmeticException ex) { System.out.println("Error dividing " + one + " by " + x); } x = x.add(x); try { Thread.sleep(500); } catch (Exception ex) {} } } }