Uses of Class java.lang.Long (Java Platform SE 8 )
Date: 2026-04-24

## Uses of Class
java.lang.Long

- Packages that use Long
  Package | Description
  --- | ---
  java.lang | Provides classes that are fundamental to the design of the Java programming language.
  java.nio.channels | Defines channels, which represent connections to entities that are capable of performing I/O operations, such as files and sockets; defines selectors, for multiplexed, non-blocking I/O operations.
  java.time.chrono | Generic API for calendar systems other than the default ISO.
  java.time.format | Provides classes to print and parse dates and times.
  java.time.temporal | Access to date and time using fields and units, and date time adjusters.
  java.util | Contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes (a string tokenizer, a random-number generator, and a bit array).
  java.util.stream | Classes to support functional-style operations on streams of elements, such as map-reduce transformations on collections.
  javax.management.openmbean | Provides the open data types and Open MBean descriptor classes.
  javax.management.timer | Provides the definition of the Timer MBean.

- - ### Uses of Long in java.lang

    Fields in java.lang with type parameters of type Long
    Modifier and Type | Field and Description
    --- | ---
    `static Class<Long>` | Long.`TYPE` The `Class` instance representing the primitive type `long`.

    Methods in java.lang that return Long
    Modifier and Type | Method and Description
    --- | ---
    `static Long` | Long.`decode(String nm)` Decodes a `String` into a `Long`.
    `static Long` | Long.`getLong(String nm)` Determines the `long` value of the system property with the specified name.
    `static Long` | Long.`getLong(String nm, long val)` Determines the `long` value of the system property with the specified name.
    `static Long` | Long.`getLong(String nm, Long val)` Returns the `long` value of the system property with the specified name.
    `static Long` | Long.`valueOf(long l)` Returns a `Long` instance representing the specified `long` value.
    `static Long` | Long.`valueOf(String s)` Returns a `Long` object holding the value of the specified `String`.
    `static Long` | Long.`valueOf(String s, int radix)` Returns a `Long` object holding the value extracted from the specified `String` when parsed with the radix given by the second argument.

    Methods in java.lang with parameters of type Long
    Modifier and Type | Method and Description
    --- | ---
    `int` | Long.`compareTo(Long anotherLong)` Compares two `Long` objects numerically.
    `static Long` | Long.`getLong(String nm, Long val)` Returns the `long` value of the system property with the specified name.

  - ### Uses of Long in java.nio.channels

    Method parameters in java.nio.channels with type arguments of type Long
    Modifier and Type | Method and Description
    --- | ---
    `abstract <A> void` | AsynchronousSocketChannel.`read(ByteBuffer[] dsts, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long,? super A> handler)` Reads a sequence of bytes from this channel into a subsequence of the given buffers.
    `abstract <A> void` | AsynchronousSocketChannel.`write(ByteBuffer[] srcs, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long,? super A> handler)` Writes a sequence of bytes to this channel from a subsequence of the given buffers.

  - ### Uses of Long in java.time.chrono

    Method parameters in java.time.chrono with type arguments of type Long
    Modifier and Type | Method and Description
    --- | ---
    `LocalDate` | IsoChronology.`resolveDate(Map<TemporalField,Long> fieldValues, ResolverStyle resolverStyle)` Resolves parsed `ChronoField` values into a date during parsing.
    `ChronoLocalDate` | Chronology.`resolveDate(Map<TemporalField,Long> fieldValues, ResolverStyle resolverStyle)` Resolves parsed `ChronoField` values into a date during parsing.
    `MinguoDate` | MinguoChronology.`resolveDate(Map<TemporalField,Long> fieldValues, ResolverStyle resolverStyle)`
    `JapaneseDate` | JapaneseChronology.`resolveDate(Map<TemporalField,Long> fieldValues, ResolverStyle resolverStyle)`
    `HijrahDate` | HijrahChronology.`resolveDate(Map<TemporalField,Long> fieldValues, ResolverStyle resolverStyle)`
    `ChronoLocalDate` | AbstractChronology.`resolveDate(Map<TemporalField,Long> fieldValues, ResolverStyle resolverStyle)` Resolves parsed `ChronoField` values into a date during parsing.
    `ThaiBuddhistDate` | ThaiBuddhistChronology.`resolveDate(Map<TemporalField,Long> fieldValues, ResolverStyle resolverStyle)`

  - ### Uses of Long in java.time.format

    Method parameters in java.time.format with type arguments of type Long
    Modifier and Type | Method and Description
    --- | ---
    `DateTimeFormatterBuilder` | DateTimeFormatterBuilder.`appendText(TemporalField field, Map<Long,String> textLookup)` Appends the text of a date-time field to the formatter using the specified map to supply the text.

  - ### Uses of Long in java.time.temporal

    Method parameters in java.time.temporal with type arguments of type Long
    Modifier and Type | Method and Description
    --- | ---
    `default TemporalAccessor` | TemporalField.`resolve(Map<TemporalField,Long> fieldValues, TemporalAccessor partialTemporal, ResolverStyle resolverStyle)` Resolves this field to provide a simpler alternative or a date.

  - ### Uses of Long in java.util

    Methods in java.util that return Long
    Modifier and Type | Method and Description
    --- | ---
    `default Long` | PrimitiveIterator.OfLong.`next()` Returns the next element in the iteration.

    Method parameters in java.util with type arguments of type Long
    Modifier and Type | Method and Description
    --- | ---
    `default void` | Spliterator.OfLong.`forEachRemaining(Consumer<? super Long> action)` Performs the given action for each remaining element, sequentially in the current thread, until all elements have been processed or the action throws an exception.
    `default void` | PrimitiveIterator.OfLong.`forEachRemaining(Consumer<? super Long> action)` Performs the given action for each remaining element until all elements have been processed or the action throws an exception.
    `default boolean` | Spliterator.OfLong.`tryAdvance(Consumer<? super Long> action)` If a remaining element exists, performs the given action on it, returning `true`; else returns `false`.

  - ### Uses of Long in java.util.stream

    Methods in java.util.stream that return types with arguments of type Long
    Modifier and Type | Method and Description
    --- | ---
    `Stream<Long>` | LongStream.`boxed()` Returns a `Stream` consisting of the elements of this stream, each boxed to a `Long`.
    `static <T> Collector<T,?,Long>` | Collectors.`counting()` Returns a `Collector` accepting elements of type `T` that counts the number of input elements.
    `static <T> Collector<T,?,Long>` | Collectors.`summingLong(ToLongFunction<? super T> mapper)` Returns a `Collector` that produces the sum of a long-valued function applied to the input elements.

  - ### Uses of Long in javax.management.openmbean

    Fields in javax.management.openmbean with type parameters of type Long
    Modifier and Type | Field and Description
    --- | ---
    `static SimpleType<Long>` | SimpleType.`LONG` The `SimpleType` instance describing values whose Java class name is `java.lang.Long`.

  - ### Uses of Long in javax.management.timer

    Methods in javax.management.timer that return Long
    Modifier and Type | Method and Description
    --- | ---
    `Long` | TimerMBean.`getNbOccurences(Integer id)` Gets a copy of the remaining number of occurrences associated to a timer notification.
    `Long` | Timer.`getNbOccurences(Integer id)` Gets a copy of the remaining number of occurrences associated to a timer notification.
    `Long` | TimerMBean.`getPeriod(Integer id)` Gets a copy of the period (in milliseconds) associated to a timer notification.
    `Long` | Timer.`getPeriod(Integer id)` Gets a copy of the period (in milliseconds) associated to a timer notification.

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.