BlackBerry Interview Question

write a function which returns duplicates in an array