Questions tagged [long-integer]

A long integer is an integer number, typically twice the size of a standard integer. It is represented by the keyword 'long' in several programming languages.

A long integer is an integer number, typically twice the size of a standard integer. It is represented by the keyword 'long' in several programming languages.

http://en.wikipedia.org/wiki/Integer_(computer_science)#Long_integer

2408 questions
32
votes
9 answers

java.math.BigInteger cannot be cast to java.lang.Long

I've got List dynamics. And I want to get max result using Collections. This is my code: List dynamics=spyPathService.getDynamics(); Long max=((Long)Collections.max(dynamics)).longValue(); This is my getDynamics: public…
Tony
  • 485
  • 2
  • 7
  • 13
31
votes
5 answers

Java creating byte array whose size is represented by a long

I'm trying to create a byte array whose size is of type long. For example, think of it as: long x = _________; byte[] b = new byte[x]; Apparently you can only specify an int for the size of a byte array. Before anyone asks why I would need a byte…
jbu
  • 15,831
  • 29
  • 82
  • 105
30
votes
2 answers

Kotlin parse Hex String to Long

I am starting to work in Kotlin and I need to parse a hex String to a long, which in java can be done with Long.parseLong("ED05265A", 16); I can not find anything this in Kotlin, although I can find val i = "2".toLong() This is not what I am…
Mark Gilchrist
  • 1,972
  • 3
  • 24
  • 44
30
votes
6 answers

Difference between Long.valueOf(java.lang.String) and new Long(java.lang.String)?

I'm consolidating code written by two different people and notice that casting a String value into a Long has been done in two different ways. Coder #1 has done this: String strId = "12345678"; ... Long lId = new Long(strId); While coder #2 has…
AWT
  • 3,657
  • 5
  • 32
  • 60
29
votes
3 answers

Why does IndexOutOfBoundsException now have a constructor with a long index as a parameter in Java 16?

I was checking the implementation of IndexOutOfBoundsException in JDK 16, and I have noticed that a new constructor with a long index has been introduced: /** * Constructs a new {@code IndexOutOfBoundsException} class with an * argument indicating…
M A
  • 71,713
  • 13
  • 134
  • 174
29
votes
2 answers

The maximum string content length quota (8192) has been exceeded while reading XML data

I'm trying to pass a large string (24,000 to 50,000 characters) to a self-hosted TCP WCF service. I've upped the maxStringContentLength (everywhere) to 22008192. I read somewhere that I need to change the bindingConfiguration to "LargeBuffer" or…
user724198
29
votes
6 answers

How i can convert NSString to long value?

I have one value 100023 and I have taken it in NSString. Now I want to pass this value in my web service which contains long parameter type so how can I convert string value to long.
Ankit Vyas
  • 7,507
  • 13
  • 56
  • 89
29
votes
4 answers

Primary Key Type: int vs long

I know some software shops have been burned by using the int type for the primary key of a persistent class. That being said, not all tables grow past 2 billions. As a matter of fact, most don't. So, do you guys use the long type only for those…
Tom Tucker
  • 11,676
  • 22
  • 89
  • 130
29
votes
1 answer

In C# What's the difference between Int64 and long?

In C#, what is the difference between Int64 and long? Example: long x = 123; Int64 x = 123;
curious coder
  • 831
  • 1
  • 8
  • 13
27
votes
3 answers

convert from long long to int and the other way back in c++

How to convert from long long to int and the other way back in c++ ?? also what are the properties of long long , especially its maximum size, thank in advance ..
Loers Antario
  • 1,611
  • 6
  • 20
  • 24
26
votes
6 answers

sizeof(long) in 64-bit Windows

I have downloaded MinGW-64, so I can now compile 64-bit programs for Windows 7, using g++ 4.7.0 (experimental). But the following line: cout << sizeof(long) << " " << sizeof(void*) << endl ; prints 4 8, not 8 8. The documentation for g++ 4.6.0…
TonyK
  • 16,761
  • 4
  • 37
  • 72
26
votes
5 answers

Cast int to pointer - why cast to long first? (as in p = (void*) 42; )

In the GLib documentation, there is a chapter on type conversion macros. In the discussion on converting an int to a void* pointer it says (emphasis mine): Naively, you might try this, but it's incorrect: gpointer p; int i; p = (void*) 42; i =…
sleske
  • 81,358
  • 34
  • 189
  • 227
26
votes
1 answer

Why does java.lang.Long's .longValue() cast its (long) instance value to long?

I have been investigating the java.lang.Long class source code. Consider this: public final class Long extends Number implements Comparable { .... private final long value; .... public long longValue() { …
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
25
votes
2 answers

Convert long to two int and vice versa

How can I convert two 32 bit integers (int) to one 64 bit long and vice versa?
user1293081
  • 331
  • 1
  • 3
  • 12
24
votes
3 answers

Warning: this decimal constant is unsigned only in ISO C90

Piece of code : long rangeVar = 0; rangeVar = atol(p_value); if (rangeVar >= -2147483648 && rangeVar <= 2147483647) On compiling I get: warning: this decimal constant is unsigned only in ISO C90 Thanks in Advance
user1227514
  • 241
  • 1
  • 2
  • 5