title: Android : IF condition not working
body: <p>I have a strange problem. IF condition in my code is not working. it get into if condition even if condition is false.</p>
  
  <p>I check the values in debug mode. </p>
  
  <p>Here is my code : </p>
  
  <pre><code>for (int i = 0; i &lt; Global.shopping_name.size(); i++) {         
          try {
              double num;
              long iPart;
              double fPart;
              String fractP = "";
  
              // Get user input
              num = Double.parseDouble(Global.shopping_ammount.get(i));
  
              if(arrIngrName.contains(Global.shopping_name.get(i)));
              {
  //              Get index of element
                  indx = arrIngrName.indexOf(Global.shopping_name.get(i));
  
                  if (arrIngrType.get(indx).equalsIgnoreCase(Global.shopping_type.get(i)))    {
  
                      preValue = Double.parseDouble(arrIngrMeasure.get(i));
                      newValue =  preValue + num;
                      num = newValue;                     
                  }                   
              }
  
              iPart = (long) num;
              fPart = num - iPart;
              System.out.println("Integer part = " + iPart);
              System.out.println("Fractional part = " + fPart);            
  
              /////////////////////////////////////
  
              if  (0.062 &gt;= fPart ) {
                  fractP = "1/16";
              } else if (0.066 &gt;= fPart) {
               fractP = "1/15";
              } else if (0.100 &gt;= fPart) {
               fractP = "1/10";
              } else if (0.125 &gt;= fPart) {
               fractP ="1/8";
              } else if (0.133 &gt;= fPart) {
               fractP = "2/15";
              } else if (0.187 &gt;= fPart) {
               fractP = "3/16";
              } else if (0.200 &gt;= fPart) {
               fractP ="1/5";
              } else if (0.250 &gt;= fPart) {
               fractP = "1/4";
              } else if (0.266 &gt;= fPart) {
               fractP ="4/15";
              } else if (0.300 &gt;= fPart) {
               fractP = "3/10";
              } else if (0.312 &gt;= fPart) {
               fractP ="5/16";
              } else if (0.333 &gt;= fPart) {
               fractP = "1/3";
              } else if (0.375 &gt;= fPart) {
               fractP ="3/8";
              } else if (0.400 &gt;= fPart) {
               fractP = "2/5";
              } else if (0.437 &gt;= fPart) {
               fractP ="7/16";                
              } else if (0.466 &gt;= fPart) {
               fractP ="7/15";                
              } else if (0.500 &gt;= fPart) {
               fractP = "1/2";
              } else if (0.533 &gt;= fPart) {
               fractP = "8/15";
              } else if (0.562 &gt;= fPart) {
               fractP = "9/16";               
              } else if (0.600 &gt;= fPart) {
               fractP ="3/5";             
              } else if (0.625 &gt;= fPart) {
               fractP = "5/8";                
              } else if (0.666 &gt;= fPart) {
               fractP ="2/3";
              } else if (0.687 &gt;= fPart) {
               fractP = "11/16";
              } else if (0.700 &gt;= fPart) {
               fractP ="7/10";
              } else if (0.733 &gt;= fPart) {
               fractP ="11/15";
              } else if (0.750 &gt;= fPart) {
               fractP ="3/4";
              } else if (0.800 &gt;= fPart) {
               fractP ="4/5";
              } else if (0.812 &gt;= fPart) {
               fractP = "13/16";              
              } else if (0.866 &gt;= fPart) {
               fractP ="13/15";
              } else if (0.875 &gt;= fPart) {
               fractP = "3/4";
              } else if (0.900 &gt;= fPart) {
               fractP ="9/10";
              } else if (0.933 &gt;= fPart) {
               fractP ="14/15";
              } else if (0.937 &gt;= fPart) {
               fractP ="15/16";
              }           
  
              /////////////////////////////////////               
  
              map = new HashMap&lt;String, String&gt;();
                  map.put("rowid", "" + (i+1));
  
                  if (fPart &gt; 0 &amp;&amp; iPart &gt; 0) {
              map.put("col_1",iPart + " " +fractP + " " + Global.shopping_type.get(i));
                  } else if (fPart &gt; 0 &amp;&amp; iPart == 0) {
                      map.put("col_1",fractP + " " + Global.shopping_type.get(i));
              } else {
                  map.put("col_1",iPart + " " + Global.shopping_type.get(i));
              }                   
  
                  map.put("col_2", "    ");
                  map.put("col_3", Global.shopping_name.get(i) );
                  map.put("col_4", "Brukes i "+ Global.shopping_recipe.get(i));
  
              if(arrIngrName.contains(Global.shopping_name.get(i)));
                  {
  //                  Get index of element
                      indx = arrIngrName.indexOf(Global.shopping_name.get(i));
  
                      if (arrIngrType.get(indx).equalsIgnoreCase(Global.shopping_type.get(i))) {
  //                      Do nothing
                          Log.e("SAME", "SAME");
                      } else {
                          fillMaps.add(map);
                      }
  
                  }
  
                  if(!arrIngrName.contains(Global.shopping_name.get(i)));
                  {
  //              
                          fillMaps.add(map);                      
                  }
  
  //                      Add To array
                         arrIngrMeasure.add(Global.shopping_ammount.get(i));
                          arrIngrName.add(Global.shopping_name.get(i));
                          arrIngrType.add(Global.shopping_type.get(i));
  
                          Log.d("SIZE : ", fillMaps.toString());
  
          } catch(Exception e) {
              e.printStackTrace();
          }
          }
          }
                  return null;                
          }
  </code></pre>
  
  <p>This code is not working : </p>
  
  <pre><code>  if(arrIngrName.contains(Global.shopping_name.get(i)));
              {
  //              Get index of element
                  indx = arrIngrName.indexOf(Global.shopping_name.get(i));
  
                  if (arrIngrType.get(indx).equalsIgnoreCase(Global.shopping_type.get(i)))
                  {
  
                      preValue = Double.parseDouble(arrIngrMeasure.get(i));
                      newValue =  preValue + num;
                      num = newValue;
                      }
                  }
  </code></pre>
  
  <p>and also when I add else statment it shows error. </p>
  
  <p>Thanks</p>