001    package railo.commons.lang;
002    
003    
004    public class FormatUtil {
005            
006            /**
007             * convert given time in nanoseconds to a flaoting point number in milliseconds reduced to max 3 digits on the right site
008             * @param ns
009             * @return
010             */
011            public static double formatNSAsMSDouble(long ns){
012                    if(ns>=100000000L) return (ns/1000000L);
013                    if(ns>=10000000L) return ((ns/100000L))/10D;
014                    if(ns>=1000000L) return ((ns/10000L))/100D;
015                    return ((ns/1000L))/1000D;
016            }
017    }