Brad has actually discovered what appears to be the second most useless Java class written. Yes, it's almost impossible to follow and replaceable with a single line ... but dang ... it's just too hard to top the ObjectWrapper.
class Rounding { public static String toString( double d, int place ) { if ( place <= 0 ) { return "" + ( int ) ( d + ( ( d > 0 ) ? 0.5 : -0.5 ) ); } String s = ""; if ( d < 0 ) { s += "-"; d = -d; } d += 0.5 * Math.pow( 10, -place ); if ( d > 1 ) { int i = ( int ) d; s += i; d -= i; } else { s += "0"; } if ( d > 0 ) { d += 1.0; String f = "" + ( int ) ( d * Math.pow( 10, place ) ); s += "." + f.substring( 1 ); } return s; } }
[Advertisement]
BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!