I've written a shell script to create a number of files. The user specifies the number of files and their file extension from the command line. Here is my code
#!/bin/bash
NUM_FILES=0
FILE_TYPES=""
LOCATION=`pwd`
if [ $# -eq 0 ]; then
    echo "**** ERROR: You must specify the number of files you wish to create and (optional) the file types.\n\n"
    exit 1
fi
if [ ! -z $1 ]; then
    NUM_FILES=$1
fi
if [ ! -z $2 ]; then
    FILE_TYPES=$2
else
    FILE_TYPES=".tmp"
fi
n=$NUM_FILES
for (( i=1; i <= n; i++ )) 
do
    touch TEMP_FILE_$i.$FILE_TYPES    #Files created here - this is where my script needs work
    echo "Created file " TEMP_FILE_$i.$FILE_TYPES
done
My question relates to creating files of a specified type.  The second argument passed to the command line ($FILE_TYPES) is used to specify the extension that you want to use (txt, java, py, etc), but when I run the script Linux interprets all the files as type text and just adds the extension to the end of the file name.  
eg, running bash createFiles.sh 4 java will result in four text files being created named TEMP_FILE_1.java but viewing the directory in Linux GUI shows the files of being type text.
How can I modify the shell script so that it will create files of the type specified?