Here you can find the source of divide(long l1, long l2)
private static double divide(long l1, long l2)
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Locale; public class Main { private static double divide(long l1, long l2) { NumberFormat nf = DecimalFormat.getInstance(Locale.ENGLISH); DecimalFormat df = (DecimalFormat) nf; df.applyPattern("#.##########"); double percent = (double) l1 / (double) l2; return Double.parseDouble(df.format(percent)); }// www. j a va 2 s. c o m }