java.lang.Integer Java Examples
The following examples show how to use
java.lang.Integer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestCipherKeyWrapperTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private void wrapperPBEKeyTest(Provider p) throws InvalidKeySpecException, InvalidKeyException, NoSuchPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException, NoSuchAlgorithmException { for (String alg : PBE_ALGORITHM_AR) { String baseAlgo = alg.split("/")[0].toUpperCase(); // only run the tests on longer key lengths if unlimited version // of JCE jurisdiction policy files are installed if (Cipher.getMaxAllowedKeyLength(alg) < Integer.MAX_VALUE && (baseAlgo.endsWith("TRIPLEDES") || alg .endsWith("AES_256"))) { out.println("keyStrength > 128 within " + alg + " will not run under global policy"); continue; } SecretKeyFactory skf = SecretKeyFactory.getInstance(baseAlgo, p); SecretKey key = skf.generateSecret(new PBEKeySpec("Secret Lover" .toCharArray())); wrapTest(alg, alg, key, key, Cipher.SECRET_KEY, true); } }
Example #2
Source File: MaxFloatingPointTest.java From j2objc with Apache License 2.0 | 6 votes |
public void testFloatNarrowing() { if (System.getProperty("os.arch").equals("armv7")) { return; } float fmin = Float.NEGATIVE_INFINITY; float fmax = Float.POSITIVE_INFINITY; assertEquals("fmin as long failed", Long.MIN_VALUE, (long) fmin); assertEquals("fmax as long failed", Long.MAX_VALUE, (long) fmax); assertEquals("fmin as int failed", Integer.MIN_VALUE, (int) fmin); assertEquals("fmax as int failed", Integer.MAX_VALUE, (int) fmax); assertEquals("fmin as char failed", Character.MIN_VALUE, (char) fmin); assertEquals("fmax as char failed", Character.MAX_VALUE, (char) fmax); // Surprising values for shorts and bytes, but that's what's specified. assertEquals("fmin as short failed", 0, (short) fmin); assertEquals("fmax as short failed", -1, (short) fmax); assertEquals("fmin as byte failed", 0, (byte) fmin); assertEquals("fmax as byte failed", -1, (byte) fmax); }
Example #3
Source File: MaxFloatingPointTest.java From j2objc with Apache License 2.0 | 6 votes |
public void testDoubleNarrowing() { if (System.getProperty("os.arch").equals("armv7")) { return; } double dmin = Double.NEGATIVE_INFINITY; double dmax = Double.POSITIVE_INFINITY; assertEquals("dmin as long failed", Long.MIN_VALUE, (long) dmin); assertEquals("dmax as long failed", Long.MAX_VALUE, (long) dmax); assertEquals("dmin as int failed", Integer.MIN_VALUE, (int) dmin); assertEquals("dmax as int failed", Integer.MAX_VALUE, (int) dmax); assertEquals("dmin as char failed", Character.MIN_VALUE, (char) dmin); assertEquals("dmax as char failed", Character.MAX_VALUE, (char) dmax); assertEquals("dmin as short failed", 0, (short) dmin); assertEquals("dmax as short failed", -1, (short) dmax); assertEquals("dmin as byte failed", 0, (byte) dmin); assertEquals("dmax as byte failed", -1, (byte) dmax); }
Example #4
Source File: SpaceUtilizationCheck.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./SpaceUtilizationCheck.jsa", "-Xshare:dump"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); String stdout = output.getStdout(); ArrayList<String> utilization = findUtilization(stdout); if (utilization.size() != NUMBER_OF_CHECKED_SHARED_REGIONS ) throw new RuntimeException("The output format of sharing summary has changed"); for(String str : utilization) { int value = Integer.parseInt(str); if (value < MIN_UTILIZATION) { System.out.println(stdout); throw new RuntimeException("Utilization for one of the regions" + "is below a threshold of " + MIN_UTILIZATION + "%"); } } }
Example #5
Source File: ReviewInput.java From apollo-android with MIT License | 6 votes |
ReviewInput(int stars, Input<Integer> nullableIntFieldWithDefaultValue, Input<String> commentary, @NotNull ColorInput favoriteColor, Input<Episode> enumWithDefaultValue, @NotNull Episode nonNullableEnumWithDefaultValue, Input<Episode> nullableEnum, Input<List<Object>> listOfCustomScalar, Input<Object> customScalar, Input<List<Episode>> listOfEnums, Input<List<Integer>> listOfInt, Input<List<String>> listOfString, @NotNull List<String> listOfStringNonOptional, Input<List<ColorInput>> listOfInputTypes, Input<Boolean> booleanWithDefaultValue, Input<List<List<String>>> listOfListOfString, Input<List<List<Episode>>> listOfListOfEnum, Input<List<List<Object>>> listOfListOfCustom, Input<List<List<ColorInput>>> listOfListOfObject, Input<String> capitalizedField) { this.stars = stars; this.nullableIntFieldWithDefaultValue = nullableIntFieldWithDefaultValue; this.commentary = commentary; this.favoriteColor = favoriteColor; this.enumWithDefaultValue = enumWithDefaultValue; this.nonNullableEnumWithDefaultValue = nonNullableEnumWithDefaultValue; this.nullableEnum = nullableEnum; this.listOfCustomScalar = listOfCustomScalar; this.customScalar = customScalar; this.listOfEnums = listOfEnums; this.listOfInt = listOfInt; this.listOfString = listOfString; this.listOfStringNonOptional = listOfStringNonOptional; this.listOfInputTypes = listOfInputTypes; this.booleanWithDefaultValue = booleanWithDefaultValue; this.listOfListOfString = listOfListOfString; this.listOfListOfEnum = listOfListOfEnum; this.listOfListOfCustom = listOfListOfCustom; this.listOfListOfObject = listOfListOfObject; this.capitalizedField = capitalizedField; }
Example #6
Source File: ReviewInput.java From apollo-android with MIT License | 5 votes |
ReviewInput(int stars, Input<Integer> nullableIntFieldWithDefaultValue, Input<String> commentary, @NotNull ColorInput favoriteColor, Input<Episode> enumWithDefaultValue, @NotNull Episode nonNullableEnumWithDefaultValue, Input<Episode> nullableEnum, Input<List<Date>> listOfCustomScalar, Input<Date> customScalar, Input<List<Episode>> listOfEnums, Input<List<Integer>> listOfInt, Input<List<String>> listOfString, @NotNull List<String> listOfStringNonOptional, Input<List<ColorInput>> listOfInputTypes, Input<Boolean> booleanWithDefaultValue, Input<List<List<String>>> listOfListOfString, Input<List<List<Episode>>> listOfListOfEnum, Input<List<List<Date>>> listOfListOfCustom, Input<List<List<ColorInput>>> listOfListOfObject, Input<String> capitalizedField) { this.stars = stars; this.nullableIntFieldWithDefaultValue = nullableIntFieldWithDefaultValue; this.commentary = commentary; this.favoriteColor = favoriteColor; this.enumWithDefaultValue = enumWithDefaultValue; this.nonNullableEnumWithDefaultValue = nonNullableEnumWithDefaultValue; this.nullableEnum = nullableEnum; this.listOfCustomScalar = listOfCustomScalar; this.customScalar = customScalar; this.listOfEnums = listOfEnums; this.listOfInt = listOfInt; this.listOfString = listOfString; this.listOfStringNonOptional = listOfStringNonOptional; this.listOfInputTypes = listOfInputTypes; this.booleanWithDefaultValue = booleanWithDefaultValue; this.listOfListOfString = listOfListOfString; this.listOfListOfEnum = listOfListOfEnum; this.listOfListOfCustom = listOfListOfCustom; this.listOfListOfObject = listOfListOfObject; this.capitalizedField = capitalizedField; }
Example #7
Source File: TerrainData.java From mavlink with MIT License | 5 votes |
/** * Terrain data MSL */ @MavlinkFieldInfo( position = 5, unitSize = 2, arraySize = 16, signed = true, description = "Terrain data MSL" ) public final List<Integer> data() { return this.data; }
Example #8
Source File: CollectionSupplier.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Create a Collection test case. * * @param name name of the test case * @param collection the modifiable test collection */ public TestCase(String name, Function<Collection<Integer>, C> supplier, C collection) { this.name = name; this.supplier = supplier; this.expected = Collections.unmodifiableList( Arrays.asList(collection.toArray(new Integer[0]))); this.collection = collection; }
Example #9
Source File: RadioCalibration.java From mavlink with MIT License | 5 votes |
/** * Rudder setpoints: nose left, center, nose right */ @MavlinkFieldInfo( position = 3, unitSize = 2, arraySize = 3, description = "Rudder setpoints: nose left, center, nose right" ) public final List<Integer> rudder() { return this.rudder; }
Example #10
Source File: EscTelemetry5To8.java From mavlink with MIT License | 5 votes |
/** * Voltage. */ @MavlinkFieldInfo( position = 2, unitSize = 2, arraySize = 4, description = "Voltage." ) public final List<Integer> voltage() { return this.voltage; }
Example #11
Source File: IPAddressName.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); if (slashNdx == -1) { address = InetAddress.getByName(name).getAddress(); } else { address = new byte[32]; byte[] base = InetAddress.getByName (name.substring(0, slashNdx)).getAddress(); System.arraycopy(base, 0, address, 0, 16); // append a mask corresponding to the num of prefix bits specified int prefixLen = Integer.parseInt(name.substring(slashNdx+1)); if (prefixLen < 0 || prefixLen > 128) { throw new IOException("IPv6Address prefix length (" + prefixLen + ") in out of valid range [0,128]"); } // create new bit array initialized to zeros BitArray bitArray = new BitArray(MASKSIZE * 8); // set all most significant bits up to prefix length for (int i = 0; i < prefixLen; i++) bitArray.set(i, true); byte[] maskArray = bitArray.toByteArray(); // copy mask bytes into mask portion of address for (int i = 0; i < MASKSIZE; i++) address[MASKSIZE+i] = maskArray[i]; } }
Example #12
Source File: CollectionSupplier.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Create a Collection test case. * * @param name name of the test case * @param collection the modifiable test collection */ public TestCase(String name, Function<Collection<Integer>, C> supplier, C collection) { this.name = name; this.supplier = supplier; this.expected = Collections.unmodifiableList( Arrays.asList(collection.toArray(new Integer[0]))); this.collection = collection; }
Example #13
Source File: safeArithmetic.java From JavaSCR with MIT License | 5 votes |
private static int safeAdd(int left, int right) throws ArithmeticException { if (right > 0 ? left > Integer.MAX_VALUE - right : left < Integer.MIN_VALUE - right) { throw new ArithmeticException("Integer overflow"); //$NON-NLS-1$ } return left + right; }
Example #14
Source File: SmartBatteryStatus.java From mavlink with MIT License | 5 votes |
/** * Individual cell voltages. Batteries with more 16 cells can use the cell_offset field to * specify the cell offset for the array specified in the current message . Index values above the * valid cell count for this battery should have the UINT16_MAX value. */ @MavlinkFieldInfo( position = 9, unitSize = 2, arraySize = 16, description = "Individual cell voltages. Batteries with more 16 cells can use the cell_offset field to specify the cell offset for the array specified in the current message . Index values above the valid cell count for this battery should have the UINT16_MAX value." ) public final List<Integer> voltages() { return this.voltages; }
Example #15
Source File: EscTelemetry1To4.java From mavlink with MIT License | 5 votes |
private EscTelemetry1To4(byte[] temperature, List<Integer> voltage, List<Integer> current, List<Integer> totalcurrent, List<Integer> rpm, List<Integer> count) { this.temperature = temperature; this.voltage = voltage; this.current = current; this.totalcurrent = totalcurrent; this.rpm = rpm; this.count = count; }
Example #16
Source File: EfficientEquals.java From dataenum with Apache License 2.0 | 5 votes |
@Override public int hashCode() { int result = 0; result = result * 31 + Integer.valueOf(this.param1).hashCode(); result = result * 31 + this.param2.hashCode(); result = result * 31 + this.param3.hashCode(); return result * 31 + Double.valueOf(this.param4).hashCode(); }
Example #17
Source File: BoxedTypesMethodsConstructorStorIOContentResolverGetResolver.java From storio with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override @NonNull public BoxedTypesMethodsConstructor mapFromCursor(@NonNull StorIOContentResolver storIOContentResolver, @NonNull Cursor cursor) { Boolean field1 = null; if (!cursor.isNull(cursor.getColumnIndex("field1"))) { field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1; } Short field2 = null; if (!cursor.isNull(cursor.getColumnIndex("field2"))) { field2 = cursor.getShort(cursor.getColumnIndex("field2")); } Integer field3 = null; if (!cursor.isNull(cursor.getColumnIndex("field3"))) { field3 = cursor.getInt(cursor.getColumnIndex("field3")); } Long field4 = null; if (!cursor.isNull(cursor.getColumnIndex("field4"))) { field4 = cursor.getLong(cursor.getColumnIndex("field4")); } Float field5 = null; if (!cursor.isNull(cursor.getColumnIndex("field5"))) { field5 = cursor.getFloat(cursor.getColumnIndex("field5")); } Double field6 = null; if (!cursor.isNull(cursor.getColumnIndex("field6"))) { field6 = cursor.getDouble(cursor.getColumnIndex("field6")); } BoxedTypesMethodsConstructor object = new BoxedTypesMethodsConstructor(field1, field2, field3, field4, field5, field6); return object; }
Example #18
Source File: IPAddressName.java From hottub with GNU General Public License v2.0 | 5 votes |
private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); if (slashNdx == -1) { address = InetAddress.getByName(name).getAddress(); } else { address = new byte[32]; byte[] base = InetAddress.getByName (name.substring(0, slashNdx)).getAddress(); System.arraycopy(base, 0, address, 0, 16); // append a mask corresponding to the num of prefix bits specified int prefixLen = Integer.parseInt(name.substring(slashNdx+1)); if (prefixLen < 0 || prefixLen > 128) { throw new IOException("IPv6Address prefix length (" + prefixLen + ") in out of valid range [0,128]"); } // create new bit array initialized to zeros BitArray bitArray = new BitArray(MASKSIZE * 8); // set all most significant bits up to prefix length for (int i = 0; i < prefixLen; i++) bitArray.set(i, true); byte[] maskArray = bitArray.toByteArray(); // copy mask bytes into mask portion of address for (int i = 0; i < MASKSIZE; i++) address[MASKSIZE+i] = maskArray[i]; } }
Example #19
Source File: PrimitiveValue.java From dataenum with Apache License 2.0 | 5 votes |
@Override public int hashCode() { int result = 0; result = result * 31 + Integer.valueOf(this.param1).hashCode(); result = result * 31 + Boolean.valueOf(this.param2).hashCode(); result = result * 31 + Float.valueOf(this.param3).hashCode(); return result * 31 + Double.valueOf(this.param4).hashCode(); }
Example #20
Source File: EscTelemetry1To4.java From mavlink with MIT License | 5 votes |
/** * Current. */ @MavlinkFieldInfo( position = 3, unitSize = 2, arraySize = 4, description = "Current." ) public final List<Integer> current() { return this.current; }
Example #21
Source File: CollectionSupplier.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Create a Collection test case. * * @param name name of the test case * @param collection the modifiable test collection */ public TestCase(String name, Function<Collection<Integer>, C> supplier, C collection) { this.name = name; this.supplier = supplier; this.expected = Collections.unmodifiableList( Arrays.asList(collection.toArray(new Integer[0]))); this.collection = collection; }
Example #22
Source File: MovieParams.java From SVGAPlayer-Android with Apache License 2.0 | 5 votes |
public MovieParams(Float viewBoxWidth, Float viewBoxHeight, Integer fps, Integer frames, ByteString unknownFields) { super(ADAPTER, unknownFields); this.viewBoxWidth = viewBoxWidth; this.viewBoxHeight = viewBoxHeight; this.fps = fps; this.frames = frames; }
Example #23
Source File: AqEscTelemetry.java From mavlink with MIT License | 5 votes |
private AqEscTelemetry(long timeBootMs, int seq, int numMotors, int numInSeq, byte[] escid, List<Integer> statusAge, byte[] dataVersion, List<Long> data0, List<Long> data1) { this.timeBootMs = timeBootMs; this.seq = seq; this.numMotors = numMotors; this.numInSeq = numInSeq; this.escid = escid; this.statusAge = statusAge; this.dataVersion = dataVersion; this.data0 = data0; this.data1 = data1; }
Example #24
Source File: MaxFloatingPointTest.java From j2objc with Apache License 2.0 | 5 votes |
public void testFloatConversions() { if (System.getProperty("os.arch").equals("armv7")) { return; } Float maxFloat = Float.MAX_VALUE; assertEquals(Integer.MAX_VALUE, maxFloat.intValue()); assertEquals(Long.MAX_VALUE, maxFloat.longValue()); }
Example #25
Source File: IPAddressName.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); if (slashNdx == -1) { address = InetAddress.getByName(name).getAddress(); } else { address = new byte[32]; byte[] base = InetAddress.getByName (name.substring(0, slashNdx)).getAddress(); System.arraycopy(base, 0, address, 0, 16); // append a mask corresponding to the num of prefix bits specified int prefixLen = Integer.parseInt(name.substring(slashNdx+1)); if (prefixLen > 128) throw new IOException("IPv6Address prefix is longer than 128"); // create new bit array initialized to zeros BitArray bitArray = new BitArray(MASKSIZE * 8); // set all most significant bits up to prefix length for (int i = 0; i < prefixLen; i++) bitArray.set(i, true); byte[] maskArray = bitArray.toByteArray(); // copy mask bytes into mask portion of address for (int i = 0; i < MASKSIZE; i++) address[MASKSIZE+i] = maskArray[i]; } }
Example #26
Source File: DataBinderMapperImpl.java From Android-POS with MIT License | 5 votes |
@Override public int getLayoutId(String tag) { if (tag == null) { return 0; } Integer tmpVal = InnerLayoutIdLookup.sKeys.get(tag); return tmpVal == null ? 0 : tmpVal; }
Example #27
Source File: AutoValue_TestClassBundledGCM.java From auto-value-bundle with MIT License | 5 votes |
public static TestClassBundledGCM unbundle(Bundle bundle, Gson gson) { return new AutoValue_TestClassBundledGCM( bundle, Byte.parseByte(bundle.getString("some_byte")), Boolean.parseBoolean(bundle.getString("some_boolean")), Short.parseShort(bundle.getString("some_short")), Integer.parseInt(bundle.getString("some_int")), Long.parseLong(bundle.getString("some_long")), bundle.getString("some_char").charAt(0), Float.parseFloat(bundle.getString("some_float")), Double.parseDouble(bundle.getString("some_double")), bundle.getString("some_string"), bundle.getString("some_char_sequence"), gson.fromJson(bundle.getString("some_parcelable"), Parcelable.class), gson.fromJson(bundle.getString("some_parcelable_array_list"), new com.google.common.reflect.TypeToken<java.util.ArrayList<Parcelable>>(){}.getType()), gson.fromJson(bundle.getString("some_parcelable_sparse_array"), new com.google.common.reflect.TypeToken<android.util.SparseArray<Parcelable>>(){}.getType()), gson.fromJson(bundle.getString("some_serializable"), Serializable.class), gson.fromJson(bundle.getString("some_integer_array_list"), new com.google.common.reflect.TypeToken<java.util.ArrayList<Integer>>(){}.getType()), gson.fromJson(bundle.getString("some_string_array_list"), new com.google.common.reflect.TypeToken<java.util.ArrayList<String>>(){}.getType()), gson.fromJson(bundle.getString("some_char_sequence_array_list"), new com.google.common.reflect.TypeToken<java.util.ArrayList<CharSequence>>(){}.getType()), toPrimitive(gson.fromJson(bundle.getString("some_byte_array"), Byte[].class)), toPrimitive(gson.fromJson(bundle.getString("some_short_array"), Short[].class)), toPrimitive(gson.fromJson(bundle.getString("some_char_array"), Character[].class)), toPrimitive(gson.fromJson(bundle.getString("some_float_array"), Float[].class)), gson.fromJson(bundle.getString("some_unknown_object"), new com.google.common.reflect.TypeToken<UnknownObject>(){}.getType()), gson.fromJson(bundle.getString("some_unknown_object_list"), new com.google.common.reflect.TypeToken<ArrayList<UnknownObject>>(){}.getType()), gson.fromJson(bundle.getString("test_enum"), new com.google.common.reflect.TypeToken<TestEnum>(){}.getType())); }
Example #28
Source File: NullableExampleActivityAutoBundle.java From AutoBundle with Apache License 2.0 | 5 votes |
public static void bind(@NonNull NullableExampleActivity target, @NonNull Bundle source) { if (source.containsKey("name")) { target.name = (String) source.getString("name"); } if (source.containsKey("number")) { target.number = (Integer) source.getInt("number"); } }
Example #29
Source File: MinistryOfInformationTests.java From public with Apache License 2.0 | 5 votes |
private List<House> generateHouses(String idPrefix, String phonePrefix, int numHouses) { List<House> houses = new ArrayList<House>(); for (int i = 0; i < numHouses; ++i) { houses.add(new House(idPrefix + Integer.toString(i), i, phonePrefix + Integer.toString(i))); } return houses; }
Example #30
Source File: Programmer$Impl.java From peapod with Apache License 2.0 | 5 votes |
public void setExperience(Integer years) { if (years == null) { v.property("experience").remove(); } else { v.property("experience", years); } }