List of usage examples for java.lang Integer MIN_VALUE
int MIN_VALUE
To view the source code for java.lang Integer MIN_VALUE.
Click Source Link
From source file:ac.elements.parser.SimpleDBConverter.java
/** * Decodes zero-padded positive integer value from the string representation * /* ww w .j ava 2 s . co m*/ * com.xerox.amazonws.sdb.DataUtils * * @param value * zero-padded string representation of the integer * @return original integer value */ private static int decodeInt(String value) { return (int) (Long.parseLong(value, RADIX) - Integer.MIN_VALUE); }
From source file:org.elasticsearch.client.sniff.ElasticsearchHostsSnifferTests.java
public void testConstructorValidation() throws IOException { try {/*from w w w .j av a2s .co m*/ new ElasticsearchHostsSniffer(null, 1, ElasticsearchHostsSniffer.Scheme.HTTP); fail("should have failed"); } catch (NullPointerException e) { assertEquals("restClient cannot be null", e.getMessage()); } HttpHost httpHost = new HttpHost(httpServer.getAddress().getHostString(), httpServer.getAddress().getPort()); try (RestClient restClient = RestClient.builder(httpHost).build()) { try { new ElasticsearchHostsSniffer(restClient, 1, null); fail("should have failed"); } catch (NullPointerException e) { assertEquals(e.getMessage(), "scheme cannot be null"); } try { new ElasticsearchHostsSniffer(restClient, RandomNumbers.randomIntBetween(getRandom(), Integer.MIN_VALUE, 0), ElasticsearchHostsSniffer.Scheme.HTTP); fail("should have failed"); } catch (IllegalArgumentException e) { assertEquals(e.getMessage(), "sniffRequestTimeoutMillis must be greater than 0"); } } }
From source file:IntVector.java
/** * Removes the first occurrence of the argument from this vector. If the * object is found in this vector, each component in the vector with an * index greater or equal to the object's index is shifted downward to have * an index one smaller than the value it had previously. * /* w w w .j ava2 s . c o m*/ * @param s * Int to remove from array * * @return True if the int was removed, false if it was not found */ public final boolean removeElement(int s) { for (int i = 0; i < _size; i++) { if (_data[i] == s) { if ((i + 1) < _size) System.arraycopy(_data, i + 1, _data, i - 1, _size - i); else _data[i] = java.lang.Integer.MIN_VALUE; _size--; return true; } } return false; }
From source file:net.sourceforge.cobertura.metrics.model.coverage.CoverageRecord.java
/** * {@inheritDoc}/*w w w . j a v a2 s. c o m*/ */ @Override public int compareTo(final CoverageRecord that) { // Check sanity if (that == null) { return Integer.MIN_VALUE; } if (that == this) { return 0; } // All done. return toString().compareTo(that.toString()); }
From source file:com.github.veqryn.net.Ip4.java
/** * @return a binary integer equal to the address, * where Integer.MIN_VALUE = 128.0.0.0 * and 0 = 0.0.0.0/* www. j a va 2s. c o m*/ * and Integer.MAX_VALUE = 127.255.255.255 * and -1 = 255.255.255.255 */ public final int getBinaryInteger() { return address ^ Integer.MIN_VALUE; }
From source file:com.hunch.api.HunchQuestion.java
static HunchQuestion buildFromJSON(JSONObject json) { final HunchQuestion.Builder builder = getBuilder(); final HunchResponse.Builder respBuilder = HunchResponse.getBuilder(); // build the HunchQuestion object int id = Integer.MIN_VALUE, topicId = Integer.MIN_VALUE; String text = "", imgUrl = ""; JSONArray jsonResIds;// w w w.j a v a2 s .c o m List<HunchResponse> responses = new ArrayList<HunchResponse>(); try { jsonResIds = json.getJSONArray("responseIds"); } catch (JSONException e) { throw new RuntimeException("Couldn't build HunchQuestion!", e); } for (int i = 0; i < jsonResIds.length(); i++) { JSONObject obj = new JSONObject(); try { obj.put("responseIds", jsonResIds); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } respBuilder.init(obj); try { respBuilder.setId(jsonResIds.getInt(i)); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } responses.add(respBuilder.buildForQuestion()); } try { String tId = json.getString("topicId"); try { topicId = Integer.parseInt(tId); } catch (NumberFormatException e) { if (tId.equals("THAY")) { // Teach Hunch About You! topicId = THAY_TOPIC_ID; } else { // some other cause of the NFE throw new RuntimeException("Couldn't build HunchQuestion!", e); } } id = json.getInt("id"); text = json.getString("text"); imgUrl = json.getString("imageUrl"); } catch (NumberFormatException e) { throw new RuntimeException("Couldn't build HunchQuestion!", e); } catch (JSONException e) { throw new RuntimeException("Couldn't build HunchQuestion!", e); } finally { builder.init(json).setId(id).setTopicId(topicId).setText(text).setImageUrl(imgUrl) .setResponses(responses); } return builder.build(); }
From source file:jp.co.opentone.bsol.linkbinder.view.filter.UploadFileFilter.java
/** * int?????./*from w w w .java2 s . c o m*/ * @param value * @param defaultValue . ?????????. * @return ???int * @throws ServletException ?????????? */ private int toInt(String value, int defaultValue) throws ServletException { int result = defaultValue; if (StringUtils.isNotEmpty(value)) { result = NumberUtils.toInt(value, Integer.MIN_VALUE); if (Integer.MIN_VALUE == result) { // ???????????? throw new ServletException(String.format("Value[%s] is invalid as number.", value)); } } return result; }
From source file:gedi.util.MathUtils.java
/** * Throws an exception if n is either a real or to big to be represented by a byte. * @param n/*from w w w. j ava 2s. c o m*/ * @return */ public static int intValueExact(Number n) { if (n instanceof Integer || n instanceof Short || n instanceof Byte) return n.intValue(); double d = n.doubleValue(); long l = n.longValue(); if (d == (double) l) { if (l >= Integer.MIN_VALUE && l <= Integer.MAX_VALUE) return (int) l; } throw new NumberFormatException(); }
From source file:edu.ku.brc.specify.toycode.mexconabio.CopyPlantsFromGBIF.java
/** * @param server// w w w .j a v a2 s . c om * @param port * @param dbName * @param username * @param pwd * @throws SQLException */ public void connectToDst(final String server, final String port, final String dbName, final String username, final String pwd) throws SQLException { dstConn = connect(server, port, dbName, username, pwd); colDstStmtGNSP = dstConn.prepareStatement(TAXSEARCH_GNSP_SQL); colDstStmtGNSP.setFetchSize(Integer.MIN_VALUE); colDstStmtGN = dstConn.prepareStatement(TAXSEARCH_GN_SQL); colDstStmtGN.setFetchSize(Integer.MIN_VALUE); }
From source file:com.sisrni.managedbean.OrganismoCooperanteMB.java
public void guardarOrganismo() { try {/*from w w w .ja v a 2s .c o m*/ //seteamos el tipo organismo seleccionado el cual buscamos en la base para ver si existe utilizando el tipoorganismoservice organismoCooperante .setIdTipoOrganismo(tipoOrganismoService.findById(organismoSelected.getIdTipoOrganismo())); organismoCooperante.setIdRegion(regionSelected.getIdRegion()); organismoCooperante.setIdPais(paisSelected.getIdPais()); organismoCooperante.setIdOrganismo(Integer.MIN_VALUE); organismoService.save(organismoCooperante); tipoTelefono = tipoTelefonoService.getTipoByDesc(FIJO); telefonoFijo.setIdOrganismo(organismoCooperante); telefonoFijo.setIdTipoTelefono(tipoTelefono); telefonoService.save(telefonoFijo); inicializarVariables(); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Exito!", "La Informacion se ha registrado correctamente!")); } catch (Exception e) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error!", "el organismo no se puede ingresar.")); } }