SizeF

Inheritance: java.lang.Object

public class SizeF

Class for describing width and height dimensions in some arbitrary unit with floating-point values.

Constructors

ConstructorDescription
SizeF(float width, float height)Create a new SizeF instance.

Methods

MethodDescription
getWidth()Get the width of the size.
getHeight()Get the height of the size.
equals(Object obj)Check if this size is equal to another size.
hashCode(){@inheritDoc}
toString()Return the size represented as a string with the format “WxH”

SizeF(float width, float height)

public SizeF(float width, float height)

Create a new SizeF instance.

Parameters:

ParameterTypeDescription
widthfloatThe width of the size
heightfloatThe height of the size

getWidth()

public float getWidth()

Get the width of the size.

Returns: float - width

getHeight()

public float getHeight()

Get the height of the size.

Returns: float - height

equals(Object obj)

public boolean equals(Object obj)

Check if this size is equal to another size.

Two sizes are equal if and only if both their widths and heights are the same.

For this purpose, the width/height float values are considered to be the same if and only if the method Float#floatToIntBits(float).floatToIntBits(float) returns the identical int value when applied to each.

Parameters:

ParameterTypeDescription
objjava.lang.Object

Returns: boolean - true if the objects were equal, false otherwise

hashCode()

public int hashCode()

Returns: int

toString()

public String toString()

Return the size represented as a string with the format “WxH”

Returns: java.lang.String - string representation of the size