# Uses of Interface
java.lang.foreign.ValueLayout.OfFloat

Packages that use ValueLayout.OfFloat
Package
Description
java.lang.foreign
Provides low-level access to memory and functions outside the Java runtime.

- ## Uses of ValueLayout.OfFloat in java.lang.foreign

  Fields in java.lang.foreign declared as ValueLayout.OfFloat
  Modifier and Type
  Field
  Description
  `static final ValueLayout.OfFloat`
  ValueLayout.`JAVA_FLOAT`
  A value layout constant whose size is the same as that of a Java `float`, byte alignment set to 4, and byte order set to `ByteOrder.nativeOrder()`.
  `static final ValueLayout.OfFloat`
  ValueLayout.`JAVA_FLOAT_UNALIGNED`
  An unaligned value layout constant whose size is the same as that of a Java `float` and byte order set to `ByteOrder.nativeOrder()`.
  Methods in java.lang.foreign that return ValueLayout.OfFloat
  Modifier and Type
  Method
  Description
  `ValueLayout.OfFloat`
  ValueLayout.OfFloat.`withByteAlignment(long byteAlignment)`
  Returns a memory layout with the same characteristics as this layout, but with the given alignment constraint (in bytes).
  `ValueLayout.OfFloat`
  ValueLayout.OfFloat.`withName(String name)`
  Returns a memory layout with the same characteristics as this layout, but with the given name.
  `ValueLayout.OfFloat`
  ValueLayout.OfFloat.`withOrder(ByteOrder order)`
  Returns a value layout with the same characteristics as this layout, but with the given byte order.
  `ValueLayout.OfFloat`
  ValueLayout.OfFloat.`withoutName()`
  Returns a memory layout with the same characteristics as this layout, but with no name.
  Methods in java.lang.foreign with parameters of type ValueLayout.OfFloat
  Modifier and Type
  Method
  Description
  `default MemorySegment`
  SegmentAllocator.`allocateFrom(ValueLayout.OfFloat layout, float value)`
  Returns a new memory segment initialized with the provided float value.
  `default MemorySegment`
  SegmentAllocator.`allocateFrom(ValueLayout.OfFloat elementLayout, float... elements)`
  Returns a new memory segment initialized with the elements in the provided float array.
  `float`
  MemorySegment.`get(ValueLayout.OfFloat layout, long offset)`
  Reads a float from this segment at the given offset, with the given layout.
  `float`
  MemorySegment.`getAtIndex(ValueLayout.OfFloat layout, long index)`
  Reads a float from this segment at the given index, scaled by the given layout size.
  `void`
  MemorySegment.`set(ValueLayout.OfFloat layout, long offset, float value)`
  Writes a float into this segment at the given offset, with the given layout.
  `void`
  MemorySegment.`setAtIndex(ValueLayout.OfFloat layout, long index, float value)`
  Writes a float into this segment at the given index, scaled by the given layout size.
  `float[]`
  MemorySegment.`toArray(ValueLayout.OfFloat elementLayout)`
  Copy the contents of this memory segment into a new float array.