BlackBerry interview question

write a function which returns duplicates in an array