Necessary as in 'would have Japan been defeated without nuking them'? Then no, it wasn't necessary.
Was it smart to nuke them into submission; not waste American lives in what would have been a much longer ground war against the Japanese military and armed civilians? Yes.
I absolutely feel no remorse for Japan. They were the aggressors in WWII and they like the Nazis committed horrific war crimes. They has been seeking their own nuclear program with the intent of nuking US cities, though they were [luckily] years behind. They were developing biological warfare weapons which they kindly tested on Chinese civilians with claims of up to 500k deaths.
Around 180-250k Japanese died from the bombings and many thousands more after due to sickness. Boo-fvcking-hoo. Japan murdered(not deaths during battles) an estimated 6-7 million Chinese, Korean, Filipino and Westerners during WWII. Be it death camps, labor camps or weapons testing. Google "Japanese War Crimes" if you're interested.
I do love the "hate America" sentiment Hiroshima and Nagasaki bring up, like those haters need this to hate America.