UBS Interview Question

how do you apply group by Claus using Java