question: public Timestamp randomTimestamp ( ) { if ( random . nextInt ( 10 ) == 0 ) { return null ; } StringBuilder buff = new StringBuilder ( ) ; buff . append ( getInt ( 10 ) + 2000 ) ; buff . append ( '-' ) ; int month = getInt ( 12 ) + 1 ; if ( month < 10 ) { buff . append ( '0' ) ; } buff . append ( month ) ; buff . append ( '-' ) ; int day = getInt ( 28 ) + 1 ; if ( day < 10 ) { buff . append ( '0' ) ; } buff . append ( day ) ; buff . append ( ' ' ) ; int hour = getInt ( 24 ) ; if ( hour < 10 ) { buff . append ( '0' ) ; } buff . append ( hour ) ; buff . append ( ':' ) ; int minute = getInt ( 60 ) ; if ( minute < 10 ) { buff . append ( '0' ) ; } buff . append ( minute ) ; buff . append ( ':' ) ; int second = getInt ( 60 ) ; if ( second < 10 ) { buff . append ( '0' ) ; } buff . append ( second ) ; return Timestamp . valueOf ( buff . toString ( ) ) ; }
target:  Get a random timestamp value. In 10% of the cases, null is returned.