title: Implementing Counting semaphores in java
body: <p>I am trying to implement simple counting semaphores to help with concurrency, and when I research the topic more online for the wait(); and signal(); commands I keep seeing comments about how those are built into the java.util.conncurrent.semaphore package. </p>
  
  <p>If this is the case how can I use the commands with integer values for the wait and signal?  Or would I have to create my own wait(); and signal() methods for decrementing/incrementing the integer values stored in the semaphore?</p>
  
  <p>For example:</p>
  
  <pre><code>Semaphore count = new Semapore(4);
  </code></pre>
  
  <p>Later on in the class:</p>
  
  <pre><code>wait(count);
  </code></pre>
  
  <p>or</p>
  
  <pre><code>signal(count);
  </code></pre>
  
  <p>does this work or do I need to define the wait and signal methods myself?</p>