posted 13 years ago

Hi,

Say theres one file of X MB and I want to read it entirely and display the decimal value represented by these X MB of data. Can anyone guide me how to begin with.

[By decimal value I mean : all bits finally represent something in decimal; How can I convert X MegaBits to Deciaml value and perform arithmetic operations on this value]

Thanks in advance

Say theres one file of X MB and I want to read it entirely and display the decimal value represented by these X MB of data. Can anyone guide me how to begin with.

[By decimal value I mean : all bits finally represent something in decimal; How can I convert X MegaBits to Deciaml value and perform arithmetic operations on this value]

Thanks in advance

When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.

posted 13 years ago

I'm not sure whether i have understood u'r question fully ..

If u need a decimal value for each & every character in a file , why cant you use the ascii value of each character stored in the file .

[ October 17, 2004: Message edited by: srini vasan ]

If u need a decimal value for each & every character in a file , why cant you use the ascii value of each character stored in the file .

[ October 17, 2004: Message edited by: srini vasan ]

Thanks & regards, Srini

MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified

Yogesh Chhawasaria

Ranch Hand

Posts: 53

posted 13 years ago
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.

Ill clarify my question once more

Say theres file of size 1kb These 1024 bytes (1kb) = 1024*16 bits must be representing a final decimal value

I need this decimal value and want to perform arithmetic computations on it.

Its easy to get that decimal value for small size file; for bigger files I used BIgInteger and somehow managed it. But after a fixed size I cannot sem to read entire file contents and get that final value maybe ram limitations

What I really want is that say theres a 2GB file then that file can be represented using a unique decimal(integer) value I just want to get that value but cant seem to...

Say theres file of size 1kb These 1024 bytes (1kb) = 1024*16 bits must be representing a final decimal value

I need this decimal value and want to perform arithmetic computations on it.

Its easy to get that decimal value for small size file; for bigger files I used BIgInteger and somehow managed it. But after a fixed size I cannot sem to read entire file contents and get that final value maybe ram limitations

What I really want is that say theres a 2GB file then that file can be represented using a unique decimal(integer) value I just want to get that value but cant seem to...

posted 13 years ago

Well, with 2GB of data, you're going to bump into hard limitations of many JVMs. Sun's Linux and Windows JVMs both have heap size limits somewhat below 2GB. Your only option for directly dealing with data of this size would be to go to another language -- C/C++, probably -- and a 64 bit architecture. You can certainly play games whereby only part of the data comes into memory at once, but that adds a lot to the complexity of your code.

I'm quite interested now -- what sort of work are you doing that involves integers with 2 billion digits?

I'm quite interested now -- what sort of work are you doing that involves integers with 2 billion digits?