Having trouble with an exercises which asks me to check a value
<p>I am working through the exercises in Objects First With Java (for review before test). One exercises asked me to create a checkIndex method, which I have done correctly. The next part asks me to rewrite both my listFile and removeFile methods so that they use my checkIndex method to make sure a valid parameter has been input. I am not sure how to do this and have tried a few things. Some help would be appreciated. Thanks.</p>

<pre><code>public class MusicOrganizer
{
// An ArrayList for storing the file names of music files.
private ArrayList&lt;String&gt; files;

/**
 * Create a MusicOrganizer
 */
public MusicOrganizer()
{
    files = new ArrayList&lt;String&gt;();
}

/**
 * Add a file to the collection.
 * @param filename The file to be added.
 */
public void addFile(String filename)
{
    files.add(filename);
}

/**
 * Return the number of files in the collection.
 * @return The number of files in the collection.
 */
public int getNumberOfFiles()
{
    return files.size();
}

/**
 * List a file from the collection.
 * @param index The index of the file to be listed.
 */
public void listFile(int index)
{
        String filename = files.get(index);      //not sure
        System.out.println(filename);
    }




/**
 * Remove a file from the collection.
 * @param index The index of the file to be removed.
 */
public void removeFile(int index)
{
    if(index &gt;= 0 &amp;&amp; index &lt; files.size()-1) {
        files.remove(index);
    }
}

public String getfive(){
    return files.get(4);
}

public void addNew(String whatIsYourFavourite){
    files.add(whatIsYourFavourite);
}

public void remove(){
    files.remove(2);
}

public void checkIndex(int check){
    if ((check &gt;= 0) &amp;&amp; (check &lt;= files.size()-1)){

    }
    else{
        System.out.println("Valid range must be between 0 and -1");
    }

}

public boolean checkIndex2(int check2){
    if ((check2 &gt;= 0) &amp;&amp; (check2 &lt;= files.size()-1)){
       return true;
    }
    else{
        return false;
    }

}
}
</code></pre>
