State tax filing

Hello,
I am in similar situation,  I work in NY and rent an apartment in NJ, I understand that I need to file NY state form as non- resident and NJ as resident. My question is for example NY state withheld suppose 6000$ from my paycheck in 2019, the same amount if I had earned in NJ the state tax would be for example 4500$, then after filing the above forms with both sates will I be getting back the difference of 1500$ [NY(6000) - NJ(4500) = 1500$] ?.  Can someone please clarify using the above example.
Thanks!!