Tabnine Logo
Utils.compareLong
Code IndexAdd Tabnine to your IDE (free)

How to use
compareLong
method
in
com.ecwid.consul.Utils

Best Java code snippets using com.ecwid.consul.Utils.compareLong (Showing top 2 results out of 315)

origin: Ecwid/consul-api

public static long parseUnsignedLong(String s) {
  if (s.charAt(0) == '-') {
    throw new NumberFormatException("An unsigned long was expected. Cannot parse negative number " + s);
  }
  int length = s.length();
  // Long.MAX_VALUE is 19 digits in length so anything
  // shorter than that is trivial to parse.
  if (length < 19) {
    return Long.parseLong(s);
  }
  long front = Long.parseLong(s.substring(0, length - 1));
  int onesDigit = Character.digit(s.charAt(length - 1), 10);
  if (onesDigit < 0) {
    throw new NumberFormatException("Invalid last digit for " + onesDigit);
  }
  long result = front * 10 + onesDigit;
  if (compareLong(result + Long.MIN_VALUE, front + Long.MIN_VALUE) < 0) {
    throw new NumberFormatException("The number " + s + " is greater than 2^64");
  }
  return result;
}
origin: com.ecwid.consul/consul-api

public static long parseUnsignedLong(String s) {
  if (s.charAt(0) == '-') {
    throw new NumberFormatException("An unsigned long was expected. Cannot parse negative number " + s);
  }
  int length = s.length();
  // Long.MAX_VALUE is 19 digits in length so anything
  // shorter than that is trivial to parse.
  if (length < 19) {
    return Long.parseLong(s);
  }
  long front = Long.parseLong(s.substring(0, length - 1));
  int onesDigit = Character.digit(s.charAt(length - 1), 10);
  if (onesDigit < 0) {
    throw new NumberFormatException("Invalid last digit for " + onesDigit);
  }
  long result = front * 10 + onesDigit;
  if (compareLong(result + Long.MIN_VALUE, front + Long.MIN_VALUE) < 0) {
    throw new NumberFormatException("The number " + s + " is greater than 2^64");
  }
  return result;
}
com.ecwid.consulUtilscompareLong

Popular methods of Utils

  • assembleAgentAddress
  • encodeUrl
  • generateUrl
  • parseUnsignedLong
  • toSecondsString
  • toUnsignedString
  • encodeValue

Popular in Java

  • Reactive rest calls using spring rest template
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getSupportFragmentManager (FragmentActivity)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top 12 Jupyter Notebook extensions
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