I need to take arguments and change the extensio of the file for writting but I get java.lang.ArrayIndexOutOfBoundsException: 1
Why?

Is there any better way?

// change file name for saving the output file

        int dot = inputFile.lastIndexOf('.'); // check for the dot
        String baseName = (dot == -1) ? inputFile : inputFile.substring(0, dot); // split the input file name
        String outputFile = baseName+".bin"; // save the file weith bin extension