title: Dynamic value for CASE in java SWITCH
body: <p>I need to implement switch case statement with dynamic value for case as below.</p>
  
  <pre><code>int v1 = 5;
  int key = xx.getKey();
  
  switch (v1) {
     case key:
         .......
     case key+1:
         .......
     case key+2:
         .......
     default:
         .......
  }
  </code></pre>
  
  <p>When using this, java complains "case expressions must be constant expressions". Is there a way to use dynamic values in case. (switch variable is also dynamic value) </p>