Tabnine Logo
Integer.max
Code IndexAdd Tabnine to your IDE (free)

How to use
max
method
in
java.lang.Integer

Best Java code snippets using java.lang.Integer.max (Showing top 20 results out of 459)

origin: prestodb/presto

private static int rescaleFactor(long fromScale, long toScale)
{
  return max(0, (int) toScale - (int) fromScale);
}
origin: neo4j/neo4j

public void increment( int typeId )
{
  if ( typeId >= counts.length )
  {
    counts = Arrays.copyOf( counts, max( counts.length * 2, typeId + 1 ) );
  }
  counts[typeId]++;
  if ( typeId > highestTypeId )
  {
    highestTypeId = typeId;
  }
}
origin: neo4j/neo4j

@Override
public int processors( int delta )
{
  targetNumberOfProcessors = max( 1, min( targetNumberOfProcessors + delta, maxProcessors ) );
  return targetNumberOfProcessors;
}
origin: neo4j/neo4j

private static int highestLabelId( Labels[] data )
{
  int highest = 0;
  for ( Labels labels : data )
  {
    highest = Integer.max( highest, labels.labelId );
  }
  return highest;
}
origin: Graylog2/graylog2-server

/**
 * Ensures that an integer is within a given range.
 *
 * @param i   The number to check.
 * @param min The minimum value to return.
 * @param max The maximum value to return.
 * @return {@code i} if the number is between {@code min} and {@code max},
 *         {@code min} if {@code i} is less than the minimum,
 *         {@code max} if {@code i} is greater than the maximum.
 */
private static int intRange(int i, int min, int max) {
  return Integer.min(Integer.max(min, i), max);
}
origin: neo4j/neo4j

private synchronized void closeClient()
{
  if ( --opened == 0 )
  {
    int highestTypeId = 0;
    for ( Client client : clients )
    {
      highestTypeId = max( highestTypeId, client.highestTypeId );
    }
    long[] counts = new long[highestTypeId + 1];
    for ( Client client : clients )
    {
      client.addTo( counts );
    }
    typeCounts = new RelationshipTypeCount[counts.length];
    for ( int i = 0; i < counts.length; i++ )
    {
      typeCounts[i] = new RelationshipTypeCount( i, counts[i] );
    }
    Arrays.sort( typeCounts );
  }
}
origin: prestodb/presto

private Number getLowerBound(double error, List<? extends Number> rows, double percentile)
{
  int medianIndex = (int) (rows.size() * percentile);
  int marginOfError = (int) (rows.size() * error / 2);
  return rows.get(max(medianIndex - marginOfError, 0));
}
origin: neo4j/neo4j

requestedNumber = max( 1, requestedNumber );
if ( requestedNumber < processors.length )
origin: neo4j/neo4j

@Override
public int processors( int delta )
{
  if ( delta > 0 )
  {
    numberOfProcessors = min( numberOfProcessors + delta, maxProcessors );
  }
  else if ( delta < 0 )
  {
    numberOfProcessors = max( 1, numberOfProcessors + delta );
  }
  return numberOfProcessors;
}
origin: knowm/XChange

int rlen = min(max(segLen, r.length), r.length);
int oversize = r.length - segLen;
System.arraycopy(
origin: apache/storm

result.put("slotsUsed", supervisorSummary.get_num_used_workers());
result.put("slotsFree",
    Integer.max(supervisorSummary.get_num_workers()
        - supervisorSummary.get_num_used_workers(), 0));
Map<String, Double> totalResources = supervisorSummary.get_total_resources();
origin: neo4j/neo4j

@Test
public void shouldAddLabels() throws Exception
{
  // GIVEN
  ControlledInserter inserter = new ControlledInserter();
  long[] expected = new long[NODE_COUNT];
  try ( NativeLabelScanWriter writer = new NativeLabelScanWriter( max( 5, NODE_COUNT / 100 ), NativeLabelScanWriter.EMPTY ) )
  {
    writer.initialize( inserter );
    // WHEN
    for ( int i = 0; i < NODE_COUNT * 3; i++ )
    {
      NodeLabelUpdate update = randomUpdate( expected );
      writer.write( update );
    }
  }
  // THEN
  for ( int i = 0; i < LABEL_COUNT; i++ )
  {
    long[] expectedNodeIds = nodesWithLabel( expected, i );
    long[] actualNodeIds = asArray( new LabelScanValueIterator( inserter.nodesFor( i ), new ArrayList<>(), NO_ID ) );
    assertArrayEquals( "For label " + i, expectedNodeIds, actualNodeIds );
  }
}
origin: jamesagnew/hapi-fhir

private void addComment(ST tmplt, ElementDefinition ed) {
 if(withComments && ed.hasShort() && !ed.getId().startsWith("Extension.")) {
  int nspaces;
  char[] sep;
  nspaces = Integer.max(COMMENT_COL - tmplt.add("comment", "#").render().indexOf('#'), MIN_COMMENT_SEP);
  tmplt.remove("comment");
  sep = new char[nspaces];
  Arrays.fill(sep, ' ');
  ArrayList<String> comment_lines = split_text(ed.getShort().replace("\n", " "), MAX_CHARS);
  StringBuilder comment = new StringBuilder("# ");
  char[] indent = new char[COMMENT_COL];
  Arrays.fill(indent, ' ');
  for(int i = 0; i < comment_lines.size();) {
   comment.append(comment_lines.get(i++));
   if(i < comment_lines.size())
    comment.append("\n" + new String(indent) + "# ");
  }
  tmplt.add("comment", new String(sep) + comment.toString());
 } else {
  tmplt.add("comment", " ");
 }
}
origin: org.neo4j/neo4j-kernel

public void increment( int typeId )
{
  if ( typeId >= counts.length )
  {
    counts = Arrays.copyOf( counts, max( counts.length * 2, typeId + 1 ) );
  }
  counts[typeId]++;
  if ( typeId > highestTypeId )
  {
    highestTypeId = typeId;
  }
}
origin: andstatus/andstatus

private void removeDuplicatesWithOlder(TimelinePage<T> page, int indExistingPage) {
  for (int ind = Integer.max(indExistingPage, 0); ind < pages.size(); ind++) {
    pages.get(ind).items.removeAll(page.items);
  }
}
origin: strimzi/strimzi-kafka-operator

private int computePadding(String gunk, Map<String, Property> properties) {
  int maxLen = 0;
  for (Map.Entry<String, Property> entry: properties.entrySet()) {
    maxLen = max(maxLen, entry.getKey().length() + 1 + gunk.length());
  }
  return maxLen;
}
origin: org.neo4j/neo4j-kernel

@Override
public int processors( int delta )
{
  targetNumberOfProcessors = max( 1, min( targetNumberOfProcessors + delta, maxProcessors ) );
  return targetNumberOfProcessors;
}
origin: org.apache.atlas/atlas-repository

PaginationHelper(Collection<T> items, int offset, int limit) {
  Objects.requireNonNull(items, "items can't be empty/null");
  this.items = new ArrayList<>(items);
  this.maxSize = items.size();
  // If limit is negative then limit is effectively the maxSize, else the smaller one out of limit and maxSize
  int adjustedLimit = limit < 0 ? maxSize : Integer.min(maxSize, limit);
  // Page starting can only be between zero and adjustedLimit
  pageStart = Integer.max(0, offset);
  // Page end can't exceed the maxSize
  pageEnd = Integer.min(adjustedLimit + pageStart, maxSize);
}
origin: io.prestosql/presto-main

private Number getLowerBound(double error, List<? extends Number> rows, double percentile)
{
  int medianIndex = (int) (rows.size() * percentile);
  int marginOfError = (int) (rows.size() * error / 2);
  return rows.get(max(medianIndex - marginOfError, 0));
}
origin: org.nuxeo.elasticsearch/nuxeo-elasticsearch-audit

@Override
public int getApplicationStartedOrder() {
  int elasticOrder = ((DefaultComponent) Framework.getRuntime().getComponent(
      "org.nuxeo.elasticsearch.ElasticSearchComponent")).getApplicationStartedOrder();
  int uidgenOrder = ((DefaultComponent) Framework.getRuntime().getComponent(
      "org.nuxeo.ecm.core.uidgen.UIDGeneratorService")).getApplicationStartedOrder();
  return Integer.max(elasticOrder, uidgenOrder) + 1;
}
java.langIntegermax

Popular methods of Integer

  • parseInt
    Parses the specified string as a signed integer value using the specified radix. The ASCII character
  • toString
    Converts the specified signed integer into a string representation based on the specified radix. The
  • valueOf
    Parses the specified string as a signed integer value using the specified radix.
  • intValue
    Gets the primitive value of this int.
  • <init>
    Constructs a new Integer from the specified string.
  • toHexString
    Returns a string representation of the integer argument as an unsigned integer in base 16.The unsign
  • equals
    Compares this instance with the specified object and indicates if they are equal. In order to be equ
  • compareTo
    Compares this Integer object to another object. If the object is an Integer, this function behaves l
  • hashCode
  • compare
    Compares two int values.
  • longValue
    Returns the value of this Integer as along.
  • decode
    Parses the specified string and returns a Integer instance if the string can be decoded into an inte
  • longValue,
  • decode,
  • numberOfLeadingZeros,
  • getInteger,
  • doubleValue,
  • toBinaryString,
  • byteValue,
  • bitCount,
  • shortValue,
  • highestOneBit

Popular in Java

  • Making http requests using okhttp
  • startActivity (Activity)
  • putExtra (Intent)
  • compareTo (BigDecimal)
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Collectors (java.util.stream)
  • JFileChooser (javax.swing)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now