title: Subtract 1 digit integer
body: <p>I'm trying to write an algorithm program that has a step which involves subtracting a 1 digit integer by 1.</p>
  
  <p>Which means: 3 -> 2, 5 -> 4, 0 -> 9, etc.</p>
  
  <p>My current code is:</p>
  
  <pre class="lang-java prettyprint-override"><code>int subtractByOne(int val) {
      val = val - 1;
      return (val == -1) ? 9 : val;
  }
  </code></pre>
  
  <p>So my point is, is there any operation or formula that will change 0 -> 9, and other cases like usual without an if branch statement?</p>
  
  <p>I'm thinking about bit manipulation but I can barely find it. :(</p>