@Override public Integer toInteger(Object value) { return ((Float) value).intValue(); }
public Integer toInt(Float self) { return self.intValue(); }
/** * 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; }
public final void setBorderAlpha(final float borderAlpha) { this.borderAlpha = borderAlpha; if(borderPaint != null) { borderPaint.setAlpha(Float.valueOf(borderAlpha * ALPHA_MAX).intValue()); } }
/** * 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; }
@Override public void set(Float value) { fieldMetadata.setValue(target, value.intValue()); } };
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)); }
@Override public int getIntValue(int dictId) { return ((Float) get(dictId)).intValue(); }
@Override public int getIntValue(int dictId) { return ((Float) get(dictId)).intValue(); }
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; } }
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; }
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(); }
private int getLabel(DataSet data) { Float f = data.getLabels().maxNumber().floatValue(); return f.intValue(); }
@Override public void set(Float value) { int particleEffectLimit = value.intValue(); config.getRendering().setParticleEffectLimit(particleEffectLimit); } });
@Override public void set(Float value) { config.getRendering().setFboScale(value.intValue()); } });
@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); } } }
@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); } } }
@Override public void set(Float value) { int frameLimit = value.intValue(); if (frameLimit > 200) { config.getRendering().setFrameLimit(-1); } else { config.getRendering().setFrameLimit(frameLimit); } } });
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()); }
@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"))); }