本文整理了Java中java.lang.Integer.parseUnsignedInt()
方法的一些代码示例,展示了Integer.parseUnsignedInt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Integer.parseUnsignedInt()
方法的具体详情如下:
包路径:java.lang.Integer
类名称:Integer
方法名:parseUnsignedInt
暂无
代码示例来源:origin: KronicDeth/intellij-elixir
@NotNull
private static Optional<Integer> releaseToMajor(@NotNull Release release) {
Optional<Integer> major;
try {
major = Optional.of(Integer.parseUnsignedInt(release.major));
} catch (NumberFormatException numberFormatException) {
major = Optional.empty();
}
return major;
}
代码示例来源:origin: wildfly/wildfly
@Override
public Object getKeyMapping(String value) {
int index = Integer.parseUnsignedInt(value.substring(0, this.padding), HEX_RADIX);
KeyFormat<Object> keyFormat = this.keyFormats.get(index);
return keyFormat.parse(value.substring(this.padding));
}
}
代码示例来源:origin: KronicDeth/intellij-elixir
@NotNull
private static Optional<Integer> releaseToMinor(@NotNull Release release) {
Optional<Integer> minor;
@Nullable String releaseMinor = release.minor;
if (releaseMinor != null) {
try {
minor = Optional.of(Integer.parseUnsignedInt(release.minor));
} catch (NumberFormatException numberFormatException) {
minor = Optional.empty();
}
} else {
minor = Optional.empty();
}
return minor;
}
}
代码示例来源:origin: apache/pulsar
private static String validateHostName(String serviceName,
String[] serviceInfos,
String hostname) {
String[] parts = hostname.split(":");
if (parts.length >= 3) {
throw new IllegalArgumentException("Invalid hostname : " + hostname);
} else if (parts.length == 2) {
try {
Integer.parseUnsignedInt(parts[1]);
} catch (NumberFormatException nfe) {
throw new IllegalArgumentException("Invalid hostname : " + hostname);
}
return hostname;
} else if (parts.length == 1) {
return hostname + ":" + getServicePort(serviceName, serviceInfos);
} else {
return hostname;
}
}
代码示例来源:origin: vavr-io/vavr
/**
* Parses this {@code CharSeq} as a unsigned decimal int by calling {@link Integer#parseUnsignedInt(String)}.
* <p>
* We write
*
* <pre><code>
* int value = charSeq.parseUnsignedInt();
* </code></pre>
*
* instead of
*
* <pre><code>
* int value = Integer.parseUnsignedInt(charSeq.mkString());
* </code></pre>
*
* @return the unsigned int value represented by this {@code CharSeq} in decimal
* @throws NumberFormatException If this {@code CharSeq} does not contain a parsable unsigned int.
*/
@GwtIncompatible
public int parseUnsignedInt() {
return Integer.parseUnsignedInt(back);
}
代码示例来源:origin: vavr-io/vavr
/**
* Parses this {@code CharSeq} as a unsigned int in the specified radix
* by calling {@link Integer#parseUnsignedInt(String, int)}.
* <p>
* We write
*
* <pre><code>
* int value = charSeq.parseUnsignedInt(radix);
* </code></pre>
*
* instead of
*
* <pre><code>
* int value = Integer.parseUnsignedInt(charSeq.mkString(), radix);
* </code></pre>
*
* @param radix the radix to be used in interpreting this {@code CharSeq}
* @return the unsigned int value represented by this {@code CharSeq} in the specified radix
* @throws NumberFormatException If this {@code CharSeq} does not contain a parsable unsigned int.
*/
@GwtIncompatible
public int parseUnsignedInt(int radix) {
return Integer.parseUnsignedInt(back, radix);
}
代码示例来源:origin: checkstyle/checkstyle
result = Integer.parseUnsignedInt(txt, radix);
代码示例来源:origin: oracle/opengrok
lineno = Integer.parseUnsignedInt(lnum);
} catch (NumberFormatException e) {
lineno = 0;
代码示例来源:origin: apache/hive
final int targetNumShardsPerGranularity = Integer.parseUnsignedInt(
tableProperties.getProperty(Constants.DRUID_TARGET_SHARDS_PER_GRANULARITY, "0"));
final int maxPartitionSize = targetNumShardsPerGranularity > 0 ? -1 : HiveConf
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
/**
* Converts a positive value into an {@code int}.
*
* @param value
* to convert
* @return the value, or -1 if it wasn't a positive integral value
*/
public static int positive(String value) {
if (value != null) {
try {
return Integer.parseUnsignedInt(value);
} catch (NumberFormatException e) {
// Ignore
}
}
return -1;
}
代码示例来源:origin: stackoverflow.com
int uint = Integer.parseUnsignedInt("4294967295");
System.out.println(Integer.toUnsignedString(uint));
代码示例来源:origin: DV8FromTheWorld/JDA
/**
* Retrieves the JDA instance represented by the provided shard ID
* or {@code null} if none of the connected shards match the provided id.
*
* @param id
* The ID of the shard
*
* @throws java.lang.NumberFormatException
* If the provided String is {@code null} or
* cannot be resolved to an unsigned int id
*
* @return Possibly-null entity for the specified shard ID
*/
default JDA getElementById(String id)
{
return getElementById(Integer.parseUnsignedInt(id));
}
}
代码示例来源:origin: stackoverflow.com
long l = Integer.toUnsignedLong(uint);
System.out.println(l); // will print 4294967295
int x = Integer.parseUnsignedInt("4294967295");
int y = 5;
int cmp1 = Integer.compareUnsigned(x,y); // interprets x as 4294967295 (x>y)
int cmp2 = Integer.compare(x,y); // interprets x as -1 (x<y)
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
@Override
public Integer get() {
String rawValue = SystemReader.getInstance()
.getProperty(MAX_REDIRECT_SYSTEM_PROPERTY);
Integer value = Integer.valueOf(DEFAULT_MAX_REDIRECTS);
if (rawValue != null) {
try {
value = Integer.valueOf(Integer.parseUnsignedInt(rawValue));
} catch (NumberFormatException e) {
LOG.warn(MessageFormat.format(
JGitText.get().invalidSystemProperty,
MAX_REDIRECT_SYSTEM_PROPERTY, rawValue, value));
}
}
return value;
}
}).get().intValue();
代码示例来源:origin: apache/accumulo
@Override
public AppenderSkeleton apply(MonitorLocation loc) {
int defaultPort = Integer.parseUnsignedInt(Property.MONITOR_LOG4J_PORT.getDefaultValue());
HostAndPort remote = HostAndPort.fromString(loc.getLocation());
SocketAppender socketAppender = new SocketAppender();
socketAppender.setApplication(System.getProperty("accumulo.application", "unknown"));
socketAppender.setRemoteHost(remote.getHost());
socketAppender.setPort(remote.getPortOrDefault(defaultPort));
return socketAppender;
}
}
代码示例来源:origin: stackoverflow.com
try {
String guessText = JOptionPane.showInputDialog("Enter your next guess");
int guess = Integer.parseUnsignedInt(guessText);
} catch (NumberFormatException ex) {
...
}
代码示例来源:origin: Netflix/iceberg
private static int getPoolSize(String systemProperty, int defaultSize) {
String value = System.getProperty(systemProperty);
if (value != null) {
try {
return Integer.parseUnsignedInt(value);
} catch (NumberFormatException e) {
// will return the default
}
}
return defaultSize;
}
}
代码示例来源:origin: stackoverflow.com
public static void main(String[] args) {
SubnetTree tree = new SubnetTree();
tree.add(Integer.parseUnsignedInt("01100110000000000000000000000000", 2), 8);
System.out.println("true: " + tree.isInRange(Integer.parseUnsignedInt("01100110000000000000100010000101", 2)));
System.out.println("false: " + tree.isInRange(Integer.parseUnsignedInt("01101110000000000000100010000101", 2)));
tree.add(Integer.parseUnsignedInt("01001110000000000000000000000000", 2), 6);
System.out.println("true: " + tree.isInRange(Integer.parseUnsignedInt("01100110000000000000100010000101", 2)));
System.out.println("false: " + tree.isInRange(Integer.parseUnsignedInt("01101110000000000000100010000101", 2)));
System.out.println("true: " + tree.isInRange(Integer.parseUnsignedInt("01001110100000000000000000000000", 2)));
System.out.println("true: " + tree.isInRange(Integer.parseUnsignedInt("01001100100000000000000000111111", 2)));
}
代码示例来源:origin: io.digdag/digdag-cli
private static Id tryParseScheduleId(String s)
{
try {
return Id.of(Integer.toString(Integer.parseUnsignedInt(s)));
}
catch (NumberFormatException ignore) {
return null;
}
}
代码示例来源:origin: org.opencypher/grammar
private static Function<String, Integer> parseInt( Repetition repetition )
{
return in -> {
int result = parseUnsignedInt( in );
return (result < repetition.minTimes() || (repetition.limited() && result > repetition.maxTimes()))
? null : result;
};
}
内容来源于网络,如有侵权,请联系作者删除!