http://java.sun.com/j2se/1.4.2/docs/api/javax/crypto/SecretKeyFactory.html
getInstance(algorithm) will return object according to what algorithm you specified. You can only use certain standard named algorithms such as AES, DES, DESede, etc. There is a list of the standard names somewhere.
As far as the generateSecretKey(keySpec) goes it will actually generate and return the key from the aforementioned object from the getInstance function.