Logical mistake or not?
<p>I have written this function which will set 
val=max or min (if val comes null)
or val=val (val comes as an Integer or "max" or "min")</p>

<p>while calling i am probably sending checkValue(val,"min") or checkValue(val,"max")</p>

<pre><code> public String checkValue(String val,String valType)
 {

   System.out.println("outside if val="+val);

   if(!val.equals("min") &amp;&amp; !val.equals("max"))
     {
     System.out.println("Inside if val="+val);

     try{
         System.out.println("*Inside try val="+val);
         Integer.parseInt(val);
         }

     catch(NumberFormatException nFE)
         {
         System.out.println("***In catch val="+val);
         val=valType;
         }

     return val;
     }
     else
     {
       return val;
     }
}
</code></pre>

<p>But the problem is if val comes null then 
outside if*<strong><em>*</em>**<em>*</em></strong>*val=null
is shown.
Can any1 tell me is this a logical mistake?
And why will I correct?</p>
