| |

VerySource

 Forgot password?
 Register
Search
View: 3059|Reply: 17

rms storage how to store int array data

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-4 12:30:01
| Show all posts |Read mode
I want to store 4 arrays of int type. Now I don't know how to store them. The data in the array exceeds the range of byte. Please give me pointers.
Reply

Use magic Report

0

Threads

8

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-1-8 23:09:01
| Show all posts
Split an int into 4 bytes to store
Reply

Use magic Report

0

Threads

12

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-1-28 16:09:01
| Show all posts
Constructs a ByteArrayOutputStream
DataOutputStream
WriteInt () in turn
Convert ByteArrayOutputStream to byte [] and store it in rms

Corresponding read:
Read byte [], convert to ByteInputStream, convert to DataInputStream
ReadInt ()
Reply

Use magic Report

0

Threads

23

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

Post time: 2020-5-26 23:00:01
| Show all posts
Stored in String mode, for example, 3000 is stored as "3000", and it is also String after taking out, and then use Integer.parseInt ("3000"); becomes an integer.
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-6-8 08:15:01
| Show all posts
Saving string is the most convenient.
Reply

Use magic Report

0

Threads

8

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-6-12 17:00:01
| Show all posts
Halo, the two upstairs, if you use string, the written code is not very troublesome?
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-7-7 06:00:01
| Show all posts
上帝的耳语


   
Divide an int into 4 byte storage

  

This method is still very useful.


It is convenient to divide an int into >> operations and divide it into 4 bytes.
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-7-9 11:00:02
| Show all posts
Convert format yourself
Or use stream
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-7-14 13:30:02
| Show all posts
dataOutputStream.writeInt(int i);

dataInputStream.readInt();
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-7-14 20:15:02
| Show all posts
Will it be troublesome to use String, don't you think?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list