By Subway
This area has relatively poor subway coverage compared to most of Brooklyn. There are no subways to the Flatlands area--the closest station is Flatbush Avenue-Brooklyn College on the 2 and 5 rush hours only--almost an hour away by walking though buses along streets like Flatbush Avenue and Avenue H can bring you there faster!
Canarsie is somewhat better served, with the L terminating at Canarsie--Rockway Parkway, which is about 25 minutes away from Jamaica Bay by walking though the B42 bus goes to Canarsie Piers from the station. The L is somewhat difficult to access from elsewhere in Brooklyn, but the G, M, J/Z, and A/C all have transfers to it.
On the other hand, if you're visiting East New York, probably the area of least interest to travelers due to the high crime, you are spoiled for choice. The 3 terminates at New Lots Avenue, the closest station to the Bay but once again, still a distance. The A/C and J/Z also have lots of stops in East New York. If you're traveling directly to Brooklyn from JFK, you will probably pass through here--rest assured, the trains are safe.