package rarinugraha;import java.util.concurrent.Semaphore;/** * * @author Rarinugraha */public class MutexEx {    static Semaphore semaphore = new Semaphore(1);    static class EToll extends Thread {        String gto = “”;        EToll(String gto) {            this.gto = gto;        }        public void run() {            try {                System.out.println(gto + ” : Nyari GTO (-_-)”);                System.out.println(gto + ” : GTO yang tersedia : ”                        + semaphore.availablePermits());                semaphore.acquire();                System.out.println(gto + ” : Masuk GTO (* ^ ? ^)”);                try {                    System.out.println(gto + ” : Lagi tapping,”                            + ” GTO yang tersedia : ”                            + semaphore.availablePermits());                    Thread.sleep(1000);                } finally {                    System.out.println(gto + ” : Selesai tapping…”);                    semaphore.release();                    System.out.println(gto + ” : GTO yang tersedia : ”                            + semaphore.availablePermits());                }            } catch (InterruptedException e) {                e.printStackTrace();            }        }    }    public static void main(String args) {        System.out.println(“Total GTO tersedia : ”                + semaphore.availablePermits());        EToll et1 = new EToll(“Alpha”);        et1.start();        EToll et2 = new EToll(“Beta”);        et2.start();        EToll et3 = new EToll(“Gamma”);        et3.start();        EToll et4 = new EToll(“Delta”);        et4.start();    }}