You allocate the income you earned to the state you earned it while working in that state or as a resident of that state.
Did you live in or work in New Jersey?