本文整理了Java中java.lang.Float.intValue()
方法的一些代码示例,展示了Float.intValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Float.intValue()
方法的具体详情如下:
包路径:java.lang.Float
类名称:Float
方法名:intValue
[英]Returns the value of this Float as an int (by casting to type int).
[中]以int形式返回此浮点值(通过强制转换为int类型)。
代码示例来源:origin: apache/incubator-pinot
@Override
public Integer toInteger(Object value) {
return ((Float) value).intValue();
}
代码示例来源:origin: jfinal/jfinal
public Integer toInt(Float self) {
return self.intValue();
}
代码示例来源:origin: jersey/jersey
/**
* Generates a "waveform" for silence.
*
* @param duration duration of the silence
* @return byte array representing silence "waveform"
*/
private static byte[] generateSilence(int duration) {
byte buffer[] = new byte[Float.valueOf(duration * (SAMPLE_RATE / 1000) + 1).intValue()];
// all the bytes are initialized with zeros
return buffer;
}
代码示例来源:origin: siyamed/android-shape-imageview
public final void setBorderAlpha(final float borderAlpha) {
this.borderAlpha = borderAlpha;
if(borderPaint != null) {
borderPaint.setAlpha(Float.valueOf(borderAlpha * ALPHA_MAX).intValue());
}
}
代码示例来源:origin: jersey/jersey
/**
* Generate the actual sinus wave of one simple tone.
*
* @param frequency frequency in Herz [Hz]
* @param volume maximum amplitude (note, that clipping/overflow may occur during mixing, if amplitude is too high)
* @param duration duration of the tone in milliseconds
* @return byte array representing the tone waveform
*/
private static byte[] generateWaveForm(int frequency, int volume, int duration) {
byte[] buffer = new byte[Float.valueOf(duration * (SAMPLE_RATE / 1000) + 1).intValue()];
for (int i = 0; i < duration * SAMPLE_RATE / 1000; i++) {
double alpha = i / (SAMPLE_RATE / frequency) * 2.0 * Math.PI;
buffer[i] = (byte) (Math.sin(alpha) * volume);
}
return buffer;
}
代码示例来源:origin: MovingBlocks/Terasology
@Override
public void set(Float value) {
fieldMetadata.setValue(target, value.intValue());
}
};
代码示例来源:origin: vondear/RxTool
private static Rect calculateTapArea(float x, float y, float coefficient, Camera.Size previewSize) {
float focusAreaSize = 300;
int areaSize = Float.valueOf(focusAreaSize * coefficient).intValue();
int centerX = (int) (x / previewSize.width - 1000);
int centerY = (int) (y / previewSize.height - 1000);
int left = clamp(centerX - areaSize / 2, -1000, 1000);
int top = clamp(centerY - areaSize / 2, -1000, 1000);
RectF rectF = new RectF(left, top, left + areaSize, top + areaSize);
return new Rect(Math.round(rectF.left), Math.round(rectF.top), Math.round(rectF.right), Math.round(rectF.bottom));
}
代码示例来源:origin: apache/incubator-pinot
@Override
public int getIntValue(int dictId) {
return ((Float) get(dictId)).intValue();
}
代码示例来源:origin: apache/incubator-pinot
@Override
public int getIntValue(int dictId) {
return ((Float) get(dictId)).intValue();
}
代码示例来源:origin: wiztools/rest-client
public static boolean hasRetinaDisplay() {
Object obj = Toolkit.getDefaultToolkit()
.getDesktopProperty("apple.awt.contentScaleFactor");
if (obj instanceof Float) {
Float f = (Float) obj;
int scale = f.intValue();
return (scale == 2);
}
return false;
}
}
代码示例来源:origin: galenframework/galen
private String unwrapProcessedObjectToString(Object returnedObject) {
if (returnedObject != null) {
if (returnedObject instanceof NativeJavaObject) {
returnedObject = ((NativeJavaObject) returnedObject).unwrap();
}
if (returnedObject instanceof Double) {
return Integer.toString(((Double) returnedObject).intValue());
} else if (returnedObject instanceof Float) {
return Integer.toString(((Float) returnedObject).intValue());
} else return returnedObject.toString();
} else return null;
}
代码示例来源:origin: a466350665/smart
public static int getMinutesByIntCompare(Date preDatetime,Date afterDatetime){
SimpleDateFormat sf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Float f = new Float(getByCompare(sf.format(preDatetime) ,sf.format(afterDatetime),3,false));
return f.intValue();
}
代码示例来源:origin: deeplearning4j/nd4j
private int getLabel(DataSet data) {
Float f = data.getLabels().maxNumber().floatValue();
return f.intValue();
}
代码示例来源:origin: MovingBlocks/Terasology
@Override
public void set(Float value) {
int particleEffectLimit = value.intValue();
config.getRendering().setParticleEffectLimit(particleEffectLimit);
}
});
代码示例来源:origin: MovingBlocks/Terasology
@Override
public void set(Float value) {
config.getRendering().setFboScale(value.intValue());
}
});
代码示例来源:origin: MovingBlocks/Terasology
@Override
@SuppressWarnings("unchecked")
public void set(Float value) {
Class<? extends Number> type = binding.fieldMetadata.getType();
if (type == Integer.TYPE || type == Integer.class) {
((Binding<Integer>) binding).set(value.intValue());
} else if (type == Float.TYPE || type == Float.class) {
((Binding<Float>) binding).set(value);
}
}
}
代码示例来源:origin: MovingBlocks/Terasology
@Override
@SuppressWarnings("unchecked")
public void set(Float value) {
Class<? extends Number> type = binding.fieldMetadata.getType();
if (type == Integer.TYPE || type == Integer.class) {
((Binding<Integer>) binding).set(value.intValue());
} else if (type == Float.TYPE || type == Float.class) {
((Binding<Float>) binding).set(value);
}
}
}
代码示例来源:origin: MovingBlocks/Terasology
@Override
public void set(Float value) {
int frameLimit = value.intValue();
if (frameLimit > 200) {
config.getRendering().setFrameLimit(-1);
} else {
config.getRendering().setFrameLimit(frameLimit);
}
}
});
代码示例来源:origin: shopizer-ecommerce/shopizer
private void discountPrice(FinalPrice finalPrice) {
finalPrice.setDiscounted(true);
double arith = finalPrice.getProductPrice().getProductPriceSpecialAmount().doubleValue() / finalPrice.getProductPrice().getProductPriceAmount().doubleValue();
double fsdiscount = 100 - (arith * 100);
Float percentagediscount = new Float(fsdiscount);
int percent = percentagediscount.intValue();
finalPrice.setDiscountPercent(percent);
//calculate percent
BigDecimal price = finalPrice.getOriginalPrice();
finalPrice.setDiscountedPrice(finalPrice.getProductPrice().getProductPriceSpecialAmount());
}
代码示例来源:origin: CalebFenton/simplify
@Test
public void canFloatToInt() {
Float value = 11204.0345F;
when(item.getValue()).thenReturn(value);
when(item.getType()).thenReturn("F");
when(instruction.getOpcode()).thenReturn(Opcode.FLOAT_TO_INT);
op = (UnaryMathOp) opFactory.create(location, addressToLocation, vm);
op.execute(node, mState);
verify(mState, times(1)).assignRegister(eq(REGISTER_A), eq(new HeapItem(value.intValue(), "I")));
}
内容来源于网络,如有侵权,请联系作者删除!