If you have GE, then not long at all. Your biggest bottleneck will be re-entering security. Of which you have three options:
1. Head back upstairs to departures through "normal" JFK security, where you can take advantage of TSA-Pre which I assume you will have, and then use the bus to get to T2.
2. Remain downstairs in arrivals and go to the little-known security checkpoint on the arrivals level, it's at the far end of the terminal (i.e. exit customs and turn left). You'll come out in T4 landside and you can take the Jitney to T2. If you're in a hurry I would try this.
3. Head up to the Airtrain and go to T2, and clear security there. I've no idea if they have TSA-Pre that side. If you have the luxury of a little time you could try this option

For any option I would leave your luggage (if you have any) with the connections desk after customs in T4.