title: 'for' loop break in Java is not working
body: <p>I have the below piece of code:</p>
  
  <pre><code>private boolean result = false;
  public boolean checkHourExist(int hourfrom,
                                int minutefrom,
                                int hourto,
                                int minuteto,
                                int day,
                                int templateId)
  {
      List&lt;templates&gt; t = getAllTemplatesWithDays();
  
      for (templates tem : t)
      {
          if(day == -1 | tem.Temp_DayId == day)
          {
              if(tem.Temp_HourFrom  &gt;= hourfrom &amp; tem.Temp_HourTo == hourto )
              {
                  if(tem.Temp_HourFrom  == hourfrom)
                  {
                      if(tem.Temp_MinFrom == minutefrom )
                      {
                          result=  true;
                          break;
                      }
                      else if(minutefrom &lt; tem.Temp_MinFrom  &amp;  minuteto &gt;= tem.Temp_MinTo )
                      {
                          result =  true;
                          break;
                      }
                  }
                  else
                  {
                      result =  true;
                      break;
                  }
              }
              else if(tem.Temp_HourFrom  == hourfrom  &amp; tem.Temp_HourTo &lt; hourto )
              {
                  result =  true;
                  break;
              }
              else if(tem.Temp_HourFrom  &gt; hourfrom  &amp; tem.Temp_HourTo &lt; hourto )
              {
                  result =  true;
                  break;
              }
          }
      }
      return result;
  }
  </code></pre>
  
  <p>When the code goes to one of my <code>if</code>s, the loop never breaks and continues until finished, and my variable result does not take the true value. I think that probably is something silly, but I can not see anything wrong.</p>