<p>Is there an easy way to convert between color models in Java (RGB, HSV and Lab). </p>

<p>Assuming RGB color model:</p>

<ul>
<li>How do I calculate black body spectrum color palette? I want to use it for a heatmap chart.</li>
<li>How about single-wavelength spectrum?</li>
</ul>

<p><strong>Edit:</strong> I found that the <a href="http://java.sun.com/javase/6/docs/api/java/awt/color/ColorSpace.html" rel="nofollow noreferrer">ColorSpace</a> class can be used for conversions between RGB/CIE and many other color models.</p>

You can build such a palette using the HSV color-model. That's easy once you have the HSV to RGB code in place and play around with the numbers for some minutes.
However, I think it's not worth it to add the code to your project just to generate a little palette.
It's much easier and less work to extract the palettes you need from a file and add them as a static array.
Photoshop let's you edit palettes and comes with a very nice black body palette as a preset.
You can simply save these as a .act file. The file itself is just a simple 256 color á 3 byte file (order is read, green, blue. 8 bits per channel).