HSSFWorkbook workbook = new HSSFWorkbook(inputStream);
colorStyle = workbook.createCellStyle();
Finally, you write the workbook to a new file, through a FileOutputStream
Now you have to loop through the rows in all workbooks, identify the duplicates, and change the style of those cells:
This answer is for .xls; the API for xlsx is very similar, though.
Reading the Excel file is easy, open a FileInputstream for the file, then create a HSSFWorkbook
To change to color of some cells, you first have to create a Style with this color (changing the style of a cell will also change some other properties, like the font etc., so things might get a bit messy here, but that's how excel works)