本文整理了Java中java.lang.reflect.Array.getInt()
方法的一些代码示例,展示了Array.getInt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Array.getInt()
方法的具体详情如下:
包路径:java.lang.reflect.Array
类名称:Array
方法名:getInt
[英]Returns the int at the given index in the given array. Applies to byte, char, int, and short arrays.
[中]返回给定数组中给定索引处的整数。适用于字节、字符、整数和短数组。
代码示例来源:origin: redisson/redisson
@Override
protected String toString(Object array, int index) {
return ForNonArrayType.INTEGER.toString(Array.getInt(array, index));
}
},
代码示例来源:origin: redisson/redisson
protected String arrayToString(Object o) {
int len = Array.getLength(o);
Class c = o.getClass().getComponentType();
String res = "[ ";
for (int i = 0; i < len; i++) {
if ( c == byte.class ) res+=Array.getByte(o,i);
if ( c == boolean.class ) res+=Array.getBoolean(o, i);
if ( c == char.class ) res+=Array.getChar(o, i);
if ( c == short.class ) res+=Array.getShort(o, i);
if ( c == int.class ) res+=Array.getInt(o, i);
if ( c == long.class ) res+=Array.getLong(o, i);
if ( c == float.class ) res+=Array.getFloat(o, i);
if ( c == double.class ) res+=Array.getDouble(o, i);
if ( i < len-1)
res+=",";
}
res += " ]";
return res;
}
代码示例来源:origin: drewnoakes/metadata-extractor
if (i != 0)
string.append(' ');
string.append(Array.getInt(o, i));
代码示例来源:origin: RuedigerMoeller/fast-serialization
protected String arrayToString(Object o) {
int len = Array.getLength(o);
Class c = o.getClass().getComponentType();
String res = "[ ";
for (int i = 0; i < len; i++) {
if ( c == byte.class ) res+=Array.getByte(o,i);
if ( c == boolean.class ) res+=Array.getBoolean(o, i);
if ( c == char.class ) res+=Array.getChar(o, i);
if ( c == short.class ) res+=Array.getShort(o, i);
if ( c == int.class ) res+=Array.getInt(o, i);
if ( c == long.class ) res+=Array.getLong(o, i);
if ( c == float.class ) res+=Array.getFloat(o, i);
if ( c == double.class ) res+=Array.getDouble(o, i);
if ( i < len-1)
res+=",";
}
res += " ]";
return res;
}
代码示例来源:origin: geotools/geotools
dest[i] = Array.getInt(array, i);
代码示例来源:origin: gstreamer-java/gst1-java-core
public Object get(Object array, int index) {
return java.lang.reflect.Array.getInt(array, index);
}
};
代码示例来源:origin: com.googlecode.gstreamer-java/gstreamer-java
public Object get(Object array, int index) {
return java.lang.reflect.Array.getInt(array, index);
}
};
代码示例来源:origin: Qihoo360/Quicksql
public int getInt(Object dataSet, int ordinal) {
return Array.getInt(dataSet, ordinal);
}
代码示例来源:origin: org.apache.calcite/calcite-core
public int getInt(Object dataSet, int ordinal) {
return Array.getInt(dataSet, ordinal);
}
代码示例来源:origin: senseidb/bobo
public int get(int r, int c) {
Object row = Array.get(_matrix, r);
if (row == null) {
throw new ArrayIndexOutOfBoundsException("index out of bounds: " + r);
}
return Array.getInt(row, c);
}
代码示例来源:origin: xuminwlt/j360-tools
public static Integer getInt(Class clazz, Object[] objects, int index) throws ArrayIndexOutOfBoundsException{
Object array = Array.newInstance(clazz, objects.length);
int length = Array.getLength(array);
if (length <= index) {
throw new ArrayIndexOutOfBoundsException();
}
for (int i = 0; i < objects.length; i++) {
Array.set(array, i, objects[i]);
}
return Array.getInt(array, index);
}
代码示例来源:origin: org.geotools/gt2-widgets-swing
/**
* Returns the value at the specified index.
*/
public Object getValueAt(final int row, final int column) {
if (column == 0) {
return new Integer(row + offset);
}
final Object array = table[column-1];
if (unsigned) {
return new Integer(Array.getInt(array, row) & 0x7FFFFFFF);
}
return Array.get(array, row);
}
代码示例来源:origin: jtransc/jtransc
static public void arrayTest() {
System.out.println("arrayTest:");
int[] items = (int[]) Array.newInstance(Integer.TYPE, 10);
for (int n = 0; n < 10; n++) items[n] = n * 10;
System.out.println(items.length);
System.out.println(items.getClass().getComponentType());
for (int n = 0; n < 10; n++) System.out.println(Array.getInt(items, n));
for (int n = 0; n < 10; n++) Array.setInt(items, n, n * 20);
for (int n = 0; n < 10; n++) System.out.println(items[n]);
for (int n = 0; n < 10; n++) Array.set(items, n, n * 40);
for (int n = 0; n < 10; n++) System.out.println(items[n] + 10);
System.out.println((new String[0]).getClass().getComponentType());
}
代码示例来源:origin: org.testifyproject.external/external-bytebuddy
@Override
protected String toString(Object array, int index) {
return ForNonArrayType.INTEGER.toString(Array.getInt(array, index));
}
},
代码示例来源:origin: org.python/jython
public String tounicode() {
if (!"u".equals(typecode)) {
throw Py.ValueError("tounicode() may only be called on type 'u' arrays");
}
int len = delegate.getSize();
int[] codepoints = new int[len];
for (int i = 0; i < len; i++) {
codepoints[i] = Array.getInt(data, i);
}
return new String(codepoints, 0, codepoints.length);
}
代码示例来源:origin: org.python/jython
/**
* Get the element at position <code>i</code> from the array
*
* @param i index of the item to be retrieved from the array
*/
@Override
protected PyObject pyget(int i) {
if ("u".equals(typecode)) {
return new PyUnicode(Array.getInt(data, i));
}
return Py.java2py(Array.get(data, i));
}
代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket
/**
* @throws IOException
* @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object,
* WicketObjectOutputStream)
*/
public void writeArray(Object object, WicketObjectOutputStream dos) throws IOException
{
int length = Array.getLength(object);
dos.writeInt(length);
for (int i = 0; i < length; i++)
{
dos.writeInt(Array.getInt(object, i));
}
}
代码示例来源:origin: numenta/htm.java
@Override
public Integer get(int index) {
int[] coordinates = computeCoordinates(index);
if (coordinates.length == 1) {
return Array.getInt(this.backingArray, index);
}
else return (Integer) ArrayUtils.getValue(this.backingArray, coordinates);
}
代码示例来源:origin: javapathfinder/jpf-core
@Test public void testArrayInt () {
if (verifyNoPropertyViolation()){
try {
int i = Array.getInt(arrayInt, 0);
assert i == 42;
Array.setInt(arrayInt, 0, 43);
assert arrayInt[0] == 43;
} catch (Throwable t) {
assert false : "unexpected exception: " + t;
}
}
}
代码示例来源:origin: com.jtransc/jtransc-rt
@JTranscSync
public static Object get(Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
Type elementType = getArrayElementType(array.getClass());
if (elementType == Boolean.TYPE) return getBoolean(array, index);
if (elementType == Byte.TYPE) return getByte(array, index);
if (elementType == Character.TYPE) return getChar(array, index);
if (elementType == Short.TYPE) return getShort(array, index);
if (elementType == Integer.TYPE) return getInt(array, index);
if (elementType == Long.TYPE) return getLong(array, index);
if (elementType == Float.TYPE) return getFloat(array, index);
if (elementType == Double.TYPE) return getDouble(array, index);
return getInstance(array, index);
}
内容来源于网络,如有侵权,请联系作者删除!