Tabnine Logo
Long.decode
Code IndexAdd Tabnine to your IDE (free)

How to use
decode
method
in
java.lang.Long

Best Java code snippets using java.lang.Long.decode (Showing top 20 results out of 2,934)

origin: google/guava

@Override
protected Long doForward(String value) {
 return Long.decode(value);
}
origin: prestodb/presto

@Override
protected Long doForward(String value) {
 return Long.decode(value);
}
origin: google/j2objc

@Override
protected Long doForward(String value) {
 return Long.decode(value);
}
origin: org.apache.commons/commons-lang3

/**
 * <p>Convert a <code>String</code> to a <code>Long</code>;
 * since 3.1 it handles hex (0Xhhhh) and octal (0ddd) notations.
 * N.B. a leading zero means octal; spaces are not trimmed.</p>
 *
 * <p>Returns <code>null</code> if the string is <code>null</code>.</p>
 *
 * @param str  a <code>String</code> to convert, may be null
 * @return converted <code>Long</code> (or null if the input is null)
 * @throws NumberFormatException if the value cannot be converted
 */
public static Long createLong(final String str) {
  if (str == null) {
    return null;
  }
  return Long.decode(str);
}
origin: wildfly/wildfly

@Override
protected Long doForward(String value) {
 return Long.decode(value);
}
origin: robolectric/robolectric

private static int convertInt(String rawValue) {
 try {
  // Decode into long, because there are some large hex values in the android resource files
  // (e.g. config_notificationsBatteryLowARGB = 0xFFFF0000 in sdk 14).
  // Integer.decode() does not support large, i.e. negative values in hex numbers.
  // try parsing decimal number
  return (int) Long.parseLong(rawValue);
 } catch (NumberFormatException nfe) {
  // try parsing hex number
  return Long.decode(rawValue).intValue();
 }
}
origin: robolectric/robolectric

private static int convertInt(String rawValue) {
 try {
  // Decode into long, because there are some large hex values in the android resource files
  // (e.g. config_notificationsBatteryLowARGB = 0xFFFF0000 in sdk 14).
  // Integer.decode() does not support large, i.e. negative values in hex numbers.
  // try parsing decimal number
  return (int) Long.parseLong(rawValue);
 } catch (NumberFormatException nfe) {
  // try parsing hex number
  return Long.decode(rawValue).intValue();
 }
}
origin: wildfly/wildfly

  public Long parseValue(final String string, final ClassLoader classLoader) throws IllegalArgumentException {
    return Long.decode(string.trim());
  }
});
origin: stackoverflow.com

 public class DecodeLong
{
  public static final void main(String[] params)
  {
    long    l;

    l = Long.decode("37648");
    System.out.println("l = " + l);
  }
}
origin: zwwill/yanxuan-weex-demo

public int getInteger(String name, int defaultValue) {
  name = name.toLowerCase(Locale.ENGLISH);
  String value = prefs.get(name);
  if (value != null) {
    // Use Integer.decode() can't handle it if the highest bit is set.
    return (int)(long) Long.decode(value);
  }
  return defaultValue;
}
origin: springside/springside4

/**
 * 将16进制的String转化为Long
 * 
 * 当str为空或非数字字符串时抛NumberFormatException
 */
public static Long hexToLongObject(@NotNull String str) {
  // 统一行为,不要有时候抛NPE,有时候抛NumberFormatException
  if (str == null) {
    throw new NumberFormatException("null");
  }
  return Long.decode(str);
}
origin: com.thoughtworks.xstream/xstream

public Object fromString(String str) {
  long value = Long.decode(str).longValue();
  if(value < Integer.MIN_VALUE || value > 0xFFFFFFFFl) {
    throw new NumberFormatException("For input string: \"" + str + '"');
  }
  return new Integer((int)value);
}
origin: apache/zookeeper

public TxnLogToolkit(String txnLogFileName, String zxidName) throws TxnLogToolkitException {
  txnLogFile = loadTxnFile(txnLogFileName);
  zxid = Long.decode(zxidName);
}
origin: springside/springside4

/**
 * 将16进制的String转化为Long,出错时返回默认值.
 */
public static Long hexToLongObject(@Nullable String str, Long defaultValue) {
  if (StringUtils.isEmpty(str)) {
    return defaultValue;
  }
  try {
    return Long.decode(str);
  } catch (final NumberFormatException nfe) {
    return defaultValue;
  }
}
origin: com.h2database/h2

/**
 * Returns the value as a long.
 *
 * @param columnIndex (1,2,...)
 * @return the value
 */
@Override
public long getLong(int columnIndex) throws SQLException {
  Object o = get(columnIndex);
  if (o != null && !(o instanceof Number)) {
    o = Long.decode(o.toString());
  }
  return o == null ? 0 : ((Number) o).longValue();
}
origin: jenkinsci/jenkins

/**
 * Determines the integer value of the system property with the
 * specified name, or a default value.
 * 
 * This behaves just like <code>Long.getLong(String,Long)</code>, except that it
 * also consults the <code>ServletContext</code>'s "init" parameters. If neither exist,
 * return the default value. 
 * 
 * @param   name property name.
 * @param   def   a default value.
 * @param   logLevel the level of the log if the provided system property name cannot be decoded into Long.
 * @return  the {@code Long} value of the property.
 *          If the property is missing, return the default value.
 *          Result may be {@code null} only if the default value is {@code null}.
 */
public static Long getLong(String name, Long def, Level logLevel) {
  String v = getString(name);
    if (v != null) {
    try {
      return Long.decode(v);
    } catch (NumberFormatException e) {
      // Ignore, fallback to default
      if (LOGGER.isLoggable(logLevel)) {
        LOGGER.log(logLevel, "Property. Value is not long: {0} => {1}", new Object[] {name, v});
      }
    }
  }
  return def;
}
origin: marytts/marytts

protected String expandInteger(String s) {
  long value;
  try {
    while (s.length() > 1 && s.startsWith("0"))
      s = s.substring(1);
    value = Long.decode(s).longValue();
  } catch (NumberFormatException e) {
    logger.info("Cannot convert string \"" + s + "\" to long.");
    throw e;
  }
  return expandInteger(value);
}
origin: spring-projects/spring-framework

return (T) (isHexNumber(trimmed) ? Long.decode(trimmed) : Long.valueOf(trimmed));
origin: jphp-group/jphp

@Signature(@Arg("value"))
public static Memory decode(Environment env, Memory... args) {
  try {
    return LongMemory.valueOf(Long.decode(args[0].toString()));
  } catch (NumberFormatException e) {
    return Memory.FALSE;
  }
}
origin: OpenHFT/Chronicle-Queue

@Test
public void shouldForwardToSpecifiedIndex() {
  final long knownIndex = Long.decode(findAnExistingIndex());
  basicReader().withStartIndex(knownIndex).execute();
  assertThat(capturedOutput.size(), is(25));
  // discard first message
  capturedOutput.poll();
  assertThat(capturedOutput.poll().contains(Long.toHexString(knownIndex)), is(true));
}
java.langLongdecode

Javadoc

Parses the specified string and returns a Long instance if the string can be decoded into a long value. The string may be an optional minus sign "-" followed by a hexadecimal ("0x..." or "#..."), octal ("0..."), or decimal ("...") representation of a long.

Popular methods of Long

  • parseLong
    Parses the string argument as a signed long in the radix specified by the second argument. The chara
  • toString
    Returns a string representation of the first argument in the radix specified by the second argument.
  • valueOf
    Returns a Long object holding the value extracted from the specified String when parsed with the rad
  • longValue
    Returns the value of this Long as a long value.
  • <init>
    Constructs a newly allocated Long object that represents the long value indicated by the String para
  • intValue
    Returns the value of this Long as an int.
  • equals
    Compares this object to the specified object. The result is true if and only if the argument is not
  • hashCode
  • toHexString
    Returns a string representation of the longargument as an unsigned integer in base 16.The unsigned l
  • compareTo
    Compares this Long object to another object. If the object is a Long, this function behaves likecomp
  • compare
    Compares two long values numerically. The value returned is identical to what would be returned by:
  • doubleValue
    Returns the value of this Long as a double.
  • compare,
  • doubleValue,
  • numberOfLeadingZeros,
  • numberOfTrailingZeros,
  • bitCount,
  • signum,
  • reverseBytes,
  • toBinaryString,
  • shortValue

Popular in Java

  • Updating database using SQL prepared statement
  • getSystemService (Context)
  • runOnUiThread (Activity)
  • getApplicationContext (Context)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • IsNull (org.hamcrest.core)
    Is the value null?
  • 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