A judge has ruled that a New Jersey police chief and one of his officers, who were recorded using racial slurs, can be fired.