List of usage examples for java.lang Long MIN_VALUE
long MIN_VALUE
To view the source code for java.lang Long MIN_VALUE.
Click Source Link
From source file:com.cloudera.oryx.rdf.common.tree.TreePath.java
TreePath extendRight() {
return new TreePath(leftRight | (Long.MIN_VALUE >>> pathLength), pathLength + 1);
}
From source file:com.basetechnology.s0.agentserver.field.IntField.java
public IntField(SymbolTable symbolTable, String name) { this.symbol = new Symbol(symbolTable, name, IntegerTypeNode.one); this.label = name; minValue = Long.MIN_VALUE; maxValue = Long.MAX_VALUE;/* w ww.j a v a2s . com*/ }
From source file:MathUtils.java
public static long multiplyAndCheck(long a, long b) { long ret;//from www . j a v a 2 s.c o m String msg = "overflow: multiply"; if (a > b) { // use symmetry to reduce boundry cases ret = multiplyAndCheck(b, a); } else { if (a < 0) { if (b < 0) { // check for positive overflow with negative a, negative b if (a >= Long.MAX_VALUE / b) { ret = a * b; } else { throw new ArithmeticException(msg); } } else if (b > 0) { // check for negative overflow with negative a, positive b if (Long.MIN_VALUE / b <= a) { ret = a * b; } else { throw new ArithmeticException(msg); } } else { // assert b == 0 ret = 0; } } else if (a > 0) { // assert a > 0 // assert b > 0 // check for positive overflow with positive a, positive b if (a <= Long.MAX_VALUE / b) { ret = a * b; } else { throw new ArithmeticException(msg); } } else { // assert a == 0 ret = 0; } } return ret; }
From source file:com.parivero.swagger.demo.controller.PersonaController.java
/** * * @return/* w w w .ja v a2 s .c o m*/ */ @RequestMapping(method = RequestMethod.GET) @ApiOperation(value = "Lista todas las personas") @ApiModel(type = Persona.class, collection = true) public @ResponseBody Collection<Persona> buscarTodos() { Persona persona = new Persona(); persona.setId(Long.MIN_VALUE); persona.setNombre("Coco"); Collection<Persona> demos = new ArrayList<>(); demos.add(persona); demos.add(persona); return demos; }
From source file:business.security.control.OwmClientTest.java
private static void assertWeatherData(StatusWeatherData weatherData) { assertNotNull(weatherData);/*from w w w.j a v a 2s. c o m*/ assertNotNull(weatherData.getName()); assertFalse(weatherData.getId() == Long.MIN_VALUE); assertFalse(weatherData.getDateTime() == Long.MIN_VALUE); assertTrue(weatherData.hasMain()); }
From source file:org.apache.drill.common.logical.data.WindowFrame.java
@JsonCreator public WindowFrame(@JsonProperty("within") FieldReference within, @JsonProperty("ref") FrameRef frame, @JsonProperty("start") Long start, @JsonProperty("end") Long end) { super();/*from ww w . jav a 2 s . c o m*/ this.within = within; this.frame = frame; this.start = start == null ? Long.MIN_VALUE : start; this.end = end == null ? Long.MIN_VALUE : end; }
From source file:io.github.benas.jpopulator.randomizers.validation.MaxValueRandomizer.java
/** * Generate a random value for the given type. * * @param type the type for which a random value will be generated * @param maxValue the maximum threshold for the generated value * @return a random value (lower than maxValue) for the given type or null if the type is not supported *///from w w w.ja v a 2 s .c o m public static Object getRandomValue(final Class type, final long maxValue) { if (type.equals(Byte.TYPE) || type.equals(Byte.class)) { return (byte) randomDataGenerator.nextLong(Byte.MIN_VALUE, maxValue); } if (type.equals(Short.TYPE) || type.equals(Short.class)) { return (short) randomDataGenerator.nextLong(Short.MIN_VALUE, maxValue); } if (type.equals(Integer.TYPE) || type.equals(Integer.class)) { return (int) randomDataGenerator.nextLong(Integer.MIN_VALUE, maxValue); } if (type.equals(Long.TYPE) || type.equals(Long.class)) { return randomDataGenerator.nextLong(Long.MIN_VALUE, maxValue); } if (type.equals(BigInteger.class)) { return new BigInteger(String.valueOf(randomDataGenerator.nextLong(Long.MIN_VALUE, maxValue))); } if (type.equals(BigDecimal.class)) { return new BigDecimal(randomDataGenerator.nextLong(Long.MIN_VALUE, maxValue)); } return null; }
From source file:Main.java
/** * Convert the bytes within the specified range of the given byte * array into a signed long in the given radix . The range extends * from <code>start</code> till, but not including <code>end</code>. <p> * * Based on java.lang.Long.parseLong()//from w w w . j a va2 s .c o m */ public static long parseLong(byte[] b, int start, int end, int radix) throws NumberFormatException { if (b == null) throw new NumberFormatException("null"); long result = 0; boolean negative = false; int i = start; long limit; long multmin; int digit; if (end > start) { if (b[i] == '-') { negative = true; limit = Long.MIN_VALUE; i++; } else { limit = -Long.MAX_VALUE; } multmin = limit / radix; if (i < end) { digit = Character.digit((char) b[i++], radix); if (digit < 0) { throw new NumberFormatException("illegal number: " + toString(b, start, end)); } else { result = -digit; } } while (i < end) { // Accumulating negatively avoids surprises near MAX_VALUE digit = Character.digit((char) b[i++], radix); if (digit < 0) { throw new NumberFormatException("illegal number"); } if (result < multmin) { throw new NumberFormatException("illegal number"); } result *= radix; if (result < limit + digit) { throw new NumberFormatException("illegal number"); } result -= digit; } } else { throw new NumberFormatException("illegal number"); } if (negative) { if (i > start + 1) { return result; } else { /* Only got "-" */ throw new NumberFormatException("illegal number"); } } else { return -result; } }
From source file:com.github.nakamurakj.validator.Validators.java
/** * ???// w w w. j av a 2 s .co m * * @param string * @param min ?? * @param max ? * @return ??<code>true</code> */ public static boolean isNumberString(String string, int min, int max) { if (string != null && string.length() >= min && string.length() <= max) { try { long value = Long.parseLong(string); return Long.MIN_VALUE <= value && value <= Long.MAX_VALUE; } catch (NumberFormatException e) { // ignore } } return false; }
From source file:org.cloudfoundry.metron.MetronMetricWriterTest.java
@Test public void incrementNoSession() { this.metricWriter.increment(new Delta<>("test-name", Long.MIN_VALUE)); verifyZeroInteractions(this.async); }