title: How to implement Unary coding?
body: <p>I have a question about how to implement <a href="http://en.wikipedia.org/wiki/Unary_coding" rel="nofollow noreferrer">unary encoding</a>. For example: How can we differ <em>n</em> (non-negative) from <em>n</em> (strictly positive)? I don’t understand a bit. Please help me.</p>
  
  <p>I have changed and written code.</p>
  
  <pre><code>public class unary {
      public static void main (String[] args) {
          int n = 10;
          int i = 0;
          String t = "";
          while (i&lt;n) {
              t += "1";
              i++;
          }
          t += "0";
          System.out.println(n);
          System.out.println("unary representation:");
          System.out.println(t);
      }
  }
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>10
  unary representation:
  11111111110
  </code></pre>
  
  <p>Is it right like this?</p>