Thread: Java
View Single Post
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 04-13-2012 , 16:27   Re: Java
Reply With Quote #6

Quote:
Originally Posted by Dr. McKay View Post
Have to instantiate an object in order to format a number?
As a side note, you're not instantiating an object as much as asking the provider for the NumberFormat abstract class to do it for you. For that matter, having not looked at the SPI code for NumberFormat, it could easily cache the instances of the various NumberFormats for the default locale, so calling getInstance only gets you a reference to an already allocated object.

Personally, I think that'd be a dumb way to do it, but meh.

Anyway, I mentioned C# because it has .ToString overloads to do formatting on the various number types. Then again, all number types in C# are structs rather than primitives.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline