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

How to use
signum
method
in
java.lang.Integer

Best Java code snippets using java.lang.Integer.signum (Showing top 20 results out of 1,899)

origin: com.h2database/h2

@Override
public int getSignum() {
  return Integer.signum(value);
}
origin: com.h2database/h2

@Override
public int getSignum() {
  return Integer.signum(ordinal);
}
origin: com.h2database/h2

@Override
public int getSignum() {
  return Integer.signum(value);
}
origin: com.h2database/h2

@Override
public int getSignum() {
  return Integer.signum(value);
}
origin: org.hamcrest/hamcrest-all

@Override
public boolean matchesSafely(T actual) {
  int compare = signum(actual.compareTo(expected));
  return minCompare <= compare && compare <= maxCompare;
}
origin: stackoverflow.com

 Collections.sort(list, new Comparator<String>() {
  public int compare(String a, String b) {
    return Integer.signum(fixString(a) - fixString(b));
  }
  private int fixString(String in) {
    return Integer.parseInt(in.substring(0, in.indexOf('_')));
  }
});
origin: google/guava

private static void runTestFuzzyCompare(int toleranceIndex) {
 double tolerance = get(TOLERANCE_CANDIDATES, toleranceIndex);
 for (double a : ALL_DOUBLE_CANDIDATES) {
  for (double b : ALL_DOUBLE_CANDIDATES) {
   int expected = DoubleMath.fuzzyEquals(a, b, tolerance) ? 0 : Double.compare(a, b);
   int actual = DoubleMath.fuzzyCompare(a, b, tolerance);
   assertEquals(Integer.signum(expected), Integer.signum(actual));
  }
 }
}
origin: neo4j/neo4j

  private <T> int compare( Comparator<T> comparator, T left, T right )
  {
    int cmp1 = comparator.compare( left, right );
    int cmp2 = comparator.compare( right, left );
    assertEquals( signum( cmp1 ), -signum( cmp2 ), format( "%s is not symmetric on %s and %s", comparator, left, right ) );
    return cmp1;
  }
}
origin: neo4j/neo4j

  private <T> int compare( Comparator<T> comparator, T left, T right )
  {
    int cmp1 = comparator.compare( left, right );
    int cmp2 = comparator.compare( right, left );
    assertEquals( signum( cmp1 ), -signum( cmp2 ), format( "%s is not symmetric on %s and %s", comparator, left, right ) );
    return cmp1;
  }
}
origin: google/guava

public void testCompare() {
 for (long a : UNSIGNED_INTS) {
  for (long b : UNSIGNED_INTS) {
   int cmpAsLongs = Longs.compare(a, b);
   int cmpAsUInt = UnsignedInts.compare((int) a, (int) b);
   assertEquals(Integer.signum(cmpAsLongs), Integer.signum(cmpAsUInt));
  }
 }
}
origin: com.h2database/h2

@Override
public int compare(Object aObj, Object bObj) {
  AutoDetectDataType aType = getType(aObj);
  AutoDetectDataType bType = getType(bObj);
  int typeDiff = aType.typeId - bType.typeId;
  if (typeDiff == 0) {
    return aType.compare(aObj, bObj);
  }
  return Integer.signum(typeDiff);
}
origin: apache/hbase

/**
 * Return true when the next encoded value in {@code src} uses Numeric
 * encoding and is {@code NaN}, false otherwise.
 */
public static boolean isNumericNaN(PositionedByteRange src) {
 return NAN == (-1 == Integer.signum(src.peek()) ? DESCENDING : ASCENDING).apply(src.peek());
}
origin: apache/hbase

/**
 * Return true when the next encoded value in {@code src} uses fixed-width
 * Int32 encoding, false otherwise.
 */
public static boolean isFixedInt32(PositionedByteRange src) {
 return FIXED_INT32 ==
   (-1 == Integer.signum(src.peek()) ? DESCENDING : ASCENDING).apply(src.peek());
}
origin: apache/hbase

/**
 * Return true when the next encoded value in {@code src} uses BlobVar
 * encoding, false otherwise.
 */
public static boolean isBlobVar(PositionedByteRange src) {
 return BLOB_VAR ==
   (-1 == Integer.signum(src.peek()) ? DESCENDING : ASCENDING).apply(src.peek());
}
origin: apache/hbase

/**
 * Return true when the next encoded value in {@code src} uses Numeric
 * encoding, false otherwise. {@code NaN}, {@code +/-Inf} are valid Numeric
 * values.
 */
public static boolean isNumeric(PositionedByteRange src) {
 byte x = (-1 == Integer.signum(src.peek()) ? DESCENDING : ASCENDING).apply(src.peek());
 return x >= NEG_INF && x <= NAN;
}
origin: apache/hbase

/**
 * Return true when the next encoded value in {@code src} uses Numeric
 * encoding and is {@code Infinite}, false otherwise.
 */
public static boolean isNumericInfinite(PositionedByteRange src) {
 byte x = (-1 == Integer.signum(src.peek()) ? DESCENDING : ASCENDING).apply(src.peek());
 return NEG_INF == x || POS_INF == x;
}
origin: apache/hbase

/**
 * Return true when the next encoded value in {@code src} uses fixed-width
 * Int8 encoding, false otherwise.
 */
public static boolean isFixedInt8(PositionedByteRange src) {
 return FIXED_INT8 ==
   (-1 == Integer.signum(src.peek()) ? DESCENDING : ASCENDING).apply(src.peek());
}
origin: apache/hbase

/**
 * Return true when the next encoded value in {@code src} uses BlobCopy
 * encoding, false otherwise.
 */
public static boolean isBlobCopy(PositionedByteRange src) {
 return BLOB_COPY ==
   (-1 == Integer.signum(src.peek()) ? DESCENDING : ASCENDING).apply(src.peek());
}
origin: com.h2database/h2

@Override
protected int compareSecure(Value v, CompareMode mode) {
  if (type == Value.CLOB) {
    return Integer.signum(getString().compareTo(v.getString()));
  }
  byte[] v2 = v.getBytesNoCopy();
  return Bits.compareNotNullSigned(getBytesNoCopy(), v2);
}
origin: redisson/redisson

/**
 * {@inheritDoc}
 */
public int compareTo(ClassFileVersion other) {
  return Integer.signum(getMajorVersion() == other.getMajorVersion()
      ? getMinorVersion() - other.getMinorVersion()
      : getMajorVersion() - other.getMajorVersion());
}
java.langIntegersignum

Javadoc

Returns the value of the signum function for the specified integer.

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 Sublime Text 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