- Java.lang - Void
- Java.lang - Throwable
- Java.lang - ThreadLocal
- Java.lang - ThreadGroup
- Java.lang - Thread
- Java.lang - System
- Java.lang - StringBuilder
- Java.lang - StringBuffer
- Java.lang - String
- Java.lang - StrictMath
- Java.lang - StackTraceElement
- Java.lang - Short
- Java.lang - SecurityManager
- Java.lang - RuntimePermission
- Java.lang - Runtime
- Java.lang - ProcessBuilder
- Java.lang - Process
- Java.lang - Package
- Java.lang - Object
- Java.lang - Number
- Java.lang - Math
- Java.lang - Long
- Java.lang - Integer
- Java.lang - InheritableThreadLocal
- Java.lang - Float
- Java.lang - Enum
- Java.lang - Double
- Java.lang - Compiler
- Java.lang - ClassLoader
- Java.lang - Class
- Java.lang - Character.UnicodeBlock
- Java.lang - Character.Subset
- Java.lang - Character
- Java.lang - Byte
- Java.lang - Boolean
- Java.lang - Home
Java.lang Package extras
Java.lang Package Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Java.lang.Long Class
Introduction
The java.lang.Long class wraps a value of the primitive type long in an object. An object of type Long contains a single field whose type is long.
Class Declaration
Following is the declaration for java.lang.Long class −
pubpc final class Long extends Number implements Comparable<Long>
Field
Following are the fields for java.lang.Long class −
static long MAX_VALUE − This is a constant holding the maximum value a long can have, 263-1.
static long MIN_VALUE − This is a constant holding the minimum value a long can have, -263.
static int SIZE − This is the number of bits used to represent a long value in two s complement binary form.
static Class<Long> TYPE − This is the class instance representing the primitive type long.
Class constructors
Sr.No. | Constructor & Description |
---|---|
1 |
Long(long value) This constructs a newly allocated Long object that represents the specified long argument. |
2 |
Long(String s) This constructs a newly allocated Long object that represents the long value indicated by the String parameter. |
Class methods
Sr.No. | Method & Description |
---|---|
1 | This method returns the number of one-bits in the two s complement binary representation of the specified long value. |
2 | This method returns the value of this Long as a byte. |
3 | This method compares two Long objects numerically. |
4 | This method decodes a String into a Long. |
5 | This method returns the value of this Long as a double. |
6 | This method compares this object to the specified object. |
7 | This method returns the value of this Long as a float. |
8 | This method determines the long value of the system property with the specified name. |
9 | This method determines the long value of the system property with the specified name. |
10 | This method returns the long value of the system property with the specified name. |
11 | This method returns a hash code for this Long. |
12 | This method returns a long value with at most a single one-bit, in the position of the highest-order ("leftmost") one-bit in the specified long value. |
13 | This method returns the value of this Long as an int. |
14 | This method returns the value of this Long as a long value. |
15 | This method returns a long value with at most a single one-bit, in the position of the lowest-order ("rightmost") one-bit in the specified long value. |
16 | This method returns the number of zero bits preceding the highest-order ("leftmost") one-bit in the two s complement binary representation of the specified long value. |
17 | This method returns the number of zero bits following the lowest-order ("rightmost") one-bit in the two s complement binary representation of the specified long value. |
18 | This method parses the string argument as a signed decimal long. |
19 | This method parses the string argument as a signed long in the radix specified by the second argument. |
20 | This method returns the value obtained by reversing the order of the bits in the two s complement binary representation of the specified long value. |
21 | This method returns the value obtained by reversing the order of the bytes in the two s complement representation of the specified long value. |
22 | This method returns the value obtained by rotating the two s complement binary representation of the specified long value left by the specified number of bits. |
23 | This method returns the value obtained by rotating the two s complement binary representation of the specified long value right by the specified number of bits. |
24 | This method returns the value of this Long as a short. |
25 | This method returns the signum function of the specified long value. |
26 | This method returns a string representation of the long argument as an unsigned integer in base 2. |
27 | This method returns a string representation of the long argument as an unsigned integer in base 16. |
28 | This method returns a string representation of the long argument as an unsigned integer in base 8. |
29 | This method returns a String object representing this Long s value. |
30 | This method returns a String object representing the specified long. |
31 | This method returns a string representation of the first argument in the radix specified by the second argument. |
32 | This method returns a Long instance representing the specified long value. |
33 | This method returns a Long object holding the value of the specified String. |
34 | This method returns a Long object holding the value extracted from the specified String when parsed with the radix given by the second argument. |
Methods inherited
This class inherits methods from the following classes −
java.lang.Object