Question: When coding in java,
How to get the corresponding file extension if the mimeType of the file is known?

Answer: 
There is no official list of file extension to mime type mappings. Each web server seems to maintain its own list. For example, Apache Tomcat has all the mappings defined in xml in the file `$CATALINA_HOME/conf/web.xml`. You could borrow the data from that list which is pretty reliable and create a `Map` for use in your own code.
make a look-up table with the mime-type as the key and the extension as the value.