JFK to Manhattan is the AirTrain plus subway (about 60 minutes) or a cab (45 to 75 minutes).
The subway runs 24/7 with an OMNY tap. Madison Square Garden sits right on top of Penn Station, so it is easy in and out.
Plan your route to UBS Arena ahead of time, and leave early to beat the crowds.