# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Ctors | Methods | Inherited Methods

# Formatter

`public final class Formatter`
`extends Object` ``

java.lang.Object
↳ | android.text.format.Formatter

Utility class to aid in formatting common values that are not covered by the `Formatter` class in `java.util`

## Summary

### Public constructors
`Formatter()`

### Public methods
`static String` | `formatFileSize(Context context, long sizeBytes)` Formats a content size to be in the form of bytes, kilobytes, megabytes, etc.
`static String` | `formatIpAddress(int ipv4Address)` This method is deprecated. Use `InetAddress.getHostAddress()`, which supports both IPv4 and IPv6 addresses. This method does not support IPv6 addresses.
`static String` | `formatShortFileSize(Context context, long sizeBytes)` Like `formatFileSize(Context, long)`, but trying to generate shorter numbers (showing fewer digits of precision).

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Public constructors

### Formatter

    public Formatter ()

## Public methods

### formatFileSize

    public static String formatFileSize (Context context,
                    long sizeBytes)

Formats a content size to be in the form of bytes, kilobytes, megabytes, etc.

As of O, the prefixes are used in their standard meanings in the SI system, so kB = 1000 bytes, MB = 1,000,000 bytes, etc.

In `Build.VERSION_CODES.N` and earlier, powers of 1024 are used instead, with KB = 1024 bytes, MB = 1,048,576 bytes, etc.

If the context has a right-to-left locale, the returned string is wrapped in bidi formatting characters to make sure it's displayed correctly if inserted inside a right-to-left string. (This is useful in cases where the unit strings, like "MB", are left-to-right, but the locale is right-to-left.)

Parameters
`context` | `Context`: Context to use to load the localized units This value may be `null`.
`sizeBytes` | `long`: size value to be formatted, in bytes

Returns
`String` | formatted string with the number

### formatIpAddress

    public static String formatIpAddress (int ipv4Address)

This method is deprecated.
Use `InetAddress.getHostAddress()`, which supports both IPv4 and IPv6 addresses. This method does not support IPv6 addresses.

Returns a string in the canonical IPv4 format ###.###.###.### from a packed integer containing the IP address. The IPv4 address is expected to be in little-endian format (LSB first). That is, 0x01020304 will return "4.3.2.1".

Parameters
`ipv4Address` | `int`

Returns
`String` |

### formatShortFileSize

    public static String formatShortFileSize (Context context,
                    long sizeBytes)

Like `formatFileSize(Context, long)`, but trying to generate shorter numbers (showing fewer digits of precision).

Parameters
`context` | `Context`: This value may be `null`.
`sizeBytes` | `long`

Returns
`String` |

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*