assertion in Java

The assertion statement has two forms. The first, simpler form is:
```
assert boolean_expression ;
```
When the system runs the assertion, it evaluates boolean_expression and if it is false throws an AssertionError with no detail message.
The second form of the assertion statement is:
```
assert boolean_expression : error_message ;
```
where:
* boolean_expression is a boolean expression.
*  error_message is an expression that has a value. (It cannot be an invocation of a method that is declared void.) 
Use this version of the assert statement to provide a detail message for the AssertionError. The system passes the value of error_message to the appropriate AssertionError constructor, which uses the string representation of the value as the error's detail message.
The purpose of the detail message is to capture and communicate the details of the assertion failure. The message should allow you to diagnose and ultimately fix the error that led the assertion to fail. 

There are many situations where it is good to use assertions, including:
* Internal Invariants
* Control-Flow Invariants
* Preconditions, Postconditions, and Class Invariants

There are also situations where you should not use them:
* Do not use assertions for argument checking in public methods. 
* Do not use assertions to do any work that your application requires for correct operation. 

To enable assertion, use -ea on java command.