List of usage examples for java.lang Integer MAX_VALUE
int MAX_VALUE
To view the source code for java.lang Integer MAX_VALUE.
Click Source Link
From source file:marshalsec.gadgets.ToStringUtil.java
public static String unhash(int hash) { int target = hash; StringBuilder answer = new StringBuilder(); if (target < 0) { // String with hash of Integer.MIN_VALUE, 0x80000000 answer.append("\\u0915\\u0009\\u001e\\u000c\\u0002"); if (target == Integer.MIN_VALUE) return answer.toString(); // Find target without sign bit set target = target & Integer.MAX_VALUE; }/* ww w .j a va 2 s . co m*/ unhash0(answer, target); return answer.toString(); }
From source file:com.anrisoftware.globalpom.version.VersionFormat.java
private void formatDuration(StringBuffer buff, Version version) { int major = version.getMajor(); int minor = version.getMinor(); int revision = version.getRevision(); buff.append(major);/*ww w . j av a2s. co m*/ if (minor != Integer.MAX_VALUE) { buff.append(VERSION_SEP).append(minor); } if (revision != Integer.MAX_VALUE) { buff.append(VERSION_SEP).append(revision); } }
From source file:com.navercorp.pinpoint.web.mapper.stat.DataSourceSamplerTest.java
private void assertEquals(SampledDataSource sampledDataSource, List<DataSourceBo> dataSourceBoList) { int minActiveConnectionSize = Integer.MAX_VALUE; int maxActiveConnectionSize = Integer.MIN_VALUE; int sumActiveConnectionSize = 0; int minMaxConnectionSize = Integer.MAX_VALUE; int maxMaxConnectionSize = Integer.MIN_VALUE; int sumMaxConnectionSize = 0; for (DataSourceBo dataSourceBo : dataSourceBoList) { int activeConnectionSize = dataSourceBo.getActiveConnectionSize(); if (activeConnectionSize < minActiveConnectionSize) { minActiveConnectionSize = activeConnectionSize; }//from ww w .java 2 s. c o m if (activeConnectionSize > maxActiveConnectionSize) { maxActiveConnectionSize = activeConnectionSize; } sumActiveConnectionSize += activeConnectionSize; int maxConnectionSize = dataSourceBo.getMaxConnectionSize(); if (maxConnectionSize < minMaxConnectionSize) { minMaxConnectionSize = maxConnectionSize; } if (maxConnectionSize > maxMaxConnectionSize) { maxMaxConnectionSize = maxConnectionSize; } sumMaxConnectionSize += maxConnectionSize; } Assert.assertTrue(sampledDataSource.getActiveConnectionSize().getMinYVal().equals(minActiveConnectionSize)); Assert.assertTrue(sampledDataSource.getActiveConnectionSize().getMaxYVal().equals(maxActiveConnectionSize)); Assert.assertTrue(sampledDataSource.getActiveConnectionSize().getSumYVal().equals(sumActiveConnectionSize)); Assert.assertTrue(sampledDataSource.getMaxConnectionSize().getMinYVal().equals(minMaxConnectionSize)); Assert.assertTrue(sampledDataSource.getMaxConnectionSize().getMaxYVal().equals(maxMaxConnectionSize)); Assert.assertTrue(sampledDataSource.getMaxConnectionSize().getSumYVal().equals(sumMaxConnectionSize)); }
From source file:input_format.MyLineRecordReader.java
public void initialize(InputSplit genericSplit, TaskAttemptContext context) throws IOException { MyFileSplit split = (MyFileSplit) (MyInputSplit) genericSplit; Configuration job = context.getConfiguration(); this.maxLineLength = job.getInt("mapred.linerecordreader.maxlength", Integer.MAX_VALUE); start = split.getStart();// w w w.ja v a 2 s . c om end = start + split.getLength(); final Path file = split.getPath(); compressionCodecs = new CompressionCodecFactory(job); final CompressionCodec codec = compressionCodecs.getCodec(file); // open the file and seek to the start of the split FileSystem fs = file.getFileSystem(job); FSDataInputStream fileIn = fs.open(split.getPath()); boolean skipFirstLine = false; if (codec != null) { in = new LineReader(codec.createInputStream(fileIn), job); end = Long.MAX_VALUE; } else { if (start != 0) { skipFirstLine = true; --start; fileIn.seek(start); } in = new LineReader(fileIn, job); } if (skipFirstLine) { // skip first line and re-establish "start". start += in.readLine(new Text(), 0, (int) Math.min((long) Integer.MAX_VALUE, end - start)); } this.pos = start; }
From source file:com.elemenopy.backupcopy.filesystem.RootFolderSynchronizer.java
public void synchronize() throws IOException { Path sourceRoot = fileSystem.getPath(sourceRootFolder.getPath()); if (!sourceRoot.toFile().isDirectory()) { throw new IllegalArgumentException("Source path " + sourceRootFolder.getPath() + " is not a directory"); }//from w ww .j a v a 2s. c om EnumSet<FileVisitOption> opts = EnumSet.of(FOLLOW_LINKS); Files.walkFileTree(sourceRoot, opts, Integer.MAX_VALUE, new SyncingFileVisitor(sourceRoot, destination)); }
From source file:gobblin.util.recordcount.LateFileRecordCountProvider.java
/** * Construct filename for a late file. If the file does not exists in the output dir, retain the original name. * Otherwise, append a LATE_COMPONENT{RandomInteger} to the original file name. * For example, if file "part1.123.avro" exists in dir "/a/b/", the returned path will be "/a/b/part1.123.late12345.avro". *//*from w w w . ja v a 2 s. c o m*/ public Path constructLateFilePath(String originalFilename, FileSystem fs, Path outputDir) throws IOException { if (!fs.exists(new Path(outputDir, originalFilename))) { return new Path(outputDir, originalFilename); } return constructLateFilePath(FilenameUtils.getBaseName(originalFilename) + LATE_COMPONENT + new Random().nextInt(Integer.MAX_VALUE) + SEPARATOR + FilenameUtils.getExtension(originalFilename), fs, outputDir); }
From source file:com.github.lynxdb.server.api.http.mappers.QueryRequest.java
/** * /* w w w .j ava2s .c om*/ * Only supporting UTC timezone rightnow * * @param _time (String|Integer|Long) the time to Object to parse * @return the time in s * @throws InvalidTimeException */ public static long parseTime(Object _time) throws InvalidTimeException { if (_time instanceof Integer || _time instanceof Long) { if ((long) _time > Integer.MAX_VALUE) { return Math.floorDiv((long) _time, 1000); } return (long) _time; } else if (_time instanceof String) { String time = _time.toString(); if (time.endsWith("-ago")) { long amount = parseDuration(time.substring(0, time.length() - 4)); if (amount >= 1000) { return Math.floorDiv((System.currentTimeMillis() - amount), 1000); } else { throw new InvalidTimeException( "Invalid time : " + _time + ". Must be greater than or equal to 1s"); } } else { SimpleDateFormat fmt; switch (time.length()) { case 10: fmt = new SimpleDateFormat("yyyy/MM/dd"); break; case 16: if (time.contains("-")) { fmt = new SimpleDateFormat("yyyy/MM/dd-HH:mm"); } else { fmt = new SimpleDateFormat("yyyy/MM/dd HH:mm"); } break; case 19: if (time.contains("-")) { fmt = new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss"); } else { fmt = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); } break; default: throw new InvalidTimeException("Invalid time date : " + _time); } fmt.setTimeZone(TimeZone.getTimeZone("UTC")); try { return Math.floorDiv(fmt.parse(time).getTime(), 1000); } catch (ParseException ex) { throw new InvalidTimeException("Invalid time date : " + _time); } } } else { throw new InvalidTimeException("Unsupported time type : " + _time); } }
From source file:com.c123.billbuddy.dal.UserDal.java
public List<User> getAllUsers() { List<User> allUsers = null; SQLQuery<User> query = new SQLQuery<User>(User.class, "order by userAccountId"); User[] users = (User[]) gigaSpace.readMultiple(query, Integer.MAX_VALUE); if (users != null) { allUsers = Arrays.asList(users); }// w ww . j a v a 2 s . c o m return allUsers; }
From source file:com.ewcms.publication.task.publish.SitePublishTest.java
protected SiteServer initSiteServer() { SiteServer server = new SiteServer(); server.setId(Integer.MAX_VALUE); server.setHostName("127.0.0.1"); server.setPath("/home/wangwei/test"); server.setUserName("wangwei"); server.setPassword("hhywangwei"); server.setOutputType(OutputType.SFTP); return server; }
From source file:org.biopax.validator.rules.EntityReferenceSamePhysicalEntitiesRule.java
public void check(final Validation validation, EntityReference eref) { Set<Set<SimplePhysicalEntity>> clasters = algorithm.cluster(eref.getEntityReferenceOf(), Integer.MAX_VALUE); // report the error case once per cluster for (Set<SimplePhysicalEntity> col : clasters) { if (col.size() > 1) { SimplePhysicalEntity u = col.iterator().next(); col.remove(u);//from w ww .java 2s . c om error(validation, eref, "same.state.entity", false, u, col); } } }