Code example for BigDecimal

Methods: setScaletoString

0
		} 
		 
		//Populate voltage 
		String voltage_text = my_battery_info.getVoltage();
		try { 
			BigDecimal big_decimal = new BigDecimal(Double.parseDouble(voltage_text) / 1000);
			big_decimal = big_decimal.setScale(2,BigDecimal.ROUND_UP);
			voltage_text = big_decimal.toString();
		} catch(Exception e) {
			 
		} 
		 
		//Populate current 
		String current_text = my_battery_info.getCurrent();
		try { 
			double curr = (Double.parseDouble(current_text));
			current_text = Double.toString(curr/1000);
		} catch(Exception e) {
			 
		} 
Stop searching for code, let great code find you!  Add Codota to your java IDE