Just curious.
To be perfectly serious, the recommendation for what language is "useful" to learn really depends on your own language learning skill --- which is a combination of inborn talent, knowing what learning methodologies suit you, and experience with compensating for a bad environment (e.g. I assume you live in the U.S. and attend an Anglophone workplace everyday).
Spanish is a pretty typical answer to this question not because it's the "most useful" but because it's not that hard for English speakers to learn, it's more widespread in the U.S. than other foreign languages, and it even has some applicability in tech (a lot of people I've seen suggesting moving to Latin America to cut your cost of living while you bootstrap your startup). Chinese/Japanese is somewhat harder to speak, a lot harder to read, a lot harder to get a visa to the country as a one-man startup, etc.
With that in mind, it makes sense to learn Spanish, which is spoken through much of Latin and South America. Chinese (Mandarin) has replaced Japanese as the 'next big economic language', so if you're looking to converse with a large new market, then perhaps Mandarin.
But for me, I dream of taking up French again. Limited global reach. No economic benefit. But I love the way it sounds coming out of my mouth. Does a form over function answer negate the 'useful for a programmer' part of your question?
The products designed in Japan (or California) are likely to be manufactured in China. If you want to participate in the final production and delivery of products you program, you'll want to consider Chinese. China's internal market is a desert of failure for software sales, though.
So on a technical basis I'd suggest 汉语 (Chinese) or 日本語 (Japanese). Too bad they're among the hardest written languages in all human history to learn. Save yourself the trouble and pick Spanish, the Internet's third or fourth most popular language. It's not a hotbed of technology but if you're living in the USA, you'll need it soon enough if demographic trends continue.
BTW, I started learning Spanish using the "Pimsleur method". It's an amazingly easy and quick way to learn a language, If you're looking for a way to learn a new language, I recommend looking it up.
I guess its sort of like if you learned C++ first, then your next language to learn should be something totally different like Scheme, Scala, Prolog or Erlang - not C or Java.