List of usage examples for java.lang Integer SIZE
int SIZE
To view the source code for java.lang Integer SIZE.
Click Source Link
From source file:org.totschnig.myexpenses.util.Utils.java
public static int pow(int b, int k) { switch (b) {//from ww w. j ava 2 s . c o m case 0: return (k == 0) ? 1 : 0; case 1: return 1; case (-1): return ((k & 1) == 0) ? 1 : -1; case 2: return (k < Integer.SIZE) ? (1 << k) : 0; case (-2): if (k < Integer.SIZE) { return ((k & 1) == 0) ? (1 << k) : -(1 << k); } else { return 0; } default: // continue below to handle the general case } for (int accum = 1;; k >>= 1) { switch (k) { case 0: return accum; case 1: return b * accum; default: accum *= ((k & 1) == 0) ? 1 : b; b *= b; } } }
From source file:org.apache.hadoop.hbase.ipc.ScheduleHBaseServer.java
protected ScheduleHBaseServer(String bindAddress, int port, Class<? extends Writable> paramClass, int handlerCount, int priorityHandlerCount, Configuration conf, String serverName, int highPriorityLevel) throws IOException { super(bindAddress, port + 1, paramClass, handlerCount, priorityHandlerCount, conf, serverName, highPriorityLevel);//w w w . j a va 2 s . c o m this.bindAddress = bindAddress; this.conf = conf; handleFreshInter = conf.getInt("hbase.schedule.refreshinter", 7); this.move = Integer.SIZE - handleFreshInter; this.port = port; this.paramClass = paramClass; this.handlerCount = handlerCount >= 10 ? handlerCount : 10; this.handlerCount = (int) (this.handlerCount * 1.5); this.priorityHandlerCount = priorityHandlerCount; this.socketSendBufferSize = 0; this.readThreads = conf.getInt("ipc.server.read.threadpool.size", 10); this.tcpNoDelay = conf.getBoolean("ipc.server.tcpnodelay", false); this.tcpKeepAlive = conf.getBoolean("ipc.server.tcpkeepalive", true); this.maxQueueSize = handlerCount * MAX_QUEUE_SIZE_PER_HANDLER; if (priorityHandlerCount > 0) { this.priorityCallQueue = new LinkedBlockingQueue<Call>(maxQueueSize); } else { this.priorityCallQueue = null; } this.highPriorityLevel = highPriorityLevel; this.maxIdleTime = 2 * conf.getInt("ipc.client.connection.maxidletime", 1000); this.maxConnectionsToNuke = conf.getInt("ipc.client.kill.max", 10); this.thresholdIdleConnections = conf.getInt("ipc.client.idlethreshold", 4000); // Start the listener here and let it bind to the port super.stop(); listener = new Listener(); responder = new Responder(); this.port = listener.getAddress().getPort(); this.rpcMetrics = new HBaseRpcMetrics(serverName, Integer.toString(this.port)); this.warnResponseSize = conf.getInt(WARN_RESPONSE_SIZE, DEFAULT_WARN_RESPONSE_SIZE); // Create the responder here }