int transitionStylesLength = transitionStyles.length;
for(Page page : document.getPages())
{
// Apply a transition to the page!
page.setTransition(
new Transition(
document,
transitionStyles[(int)(Math.random()*((double)transitionStylesLength))], // NOTE: Random selection of the transition is done here just for demonstrative purposes; in real world, you would obviously choose only the appropriate enumeration constant among those available.
Float.valueOf(.5f) // Transition duration (half a second).
)
);