Getting the supported recording format

With the JavaSound API, does anyone know how to findout programmtically what recording format is supported? Currently I'm having to use a program called Java Sound Demo to find out what format my Mac supports. This is by trial and error, not good. If not possible through the Sound API, is there any other way?