The real-time specification for Java (RTSJ) aims to make your code more time predictable. But, this predictability can easily be ruined by using the standard library library (lazy initialization, array resizing, etc). To achieve true time predictability one must have a time deterministic library such as the Javolution library (http://javolution.org). To this date, the only RTSJ compliant and time-deterministic library available (see http://javolution.org/doc/Javolution-Collections.pdf for an overview).