splitted up examples in java and javascript