I have a 2d array with 24 columns and about 800 rows. Each column consist of values either 0 or 1. I would like to store this array in derby database. I used the XMLEncoder and XMLDecoder but when deserializing 5 arrays it takes about 5 seconds which is way too long. Any other method to store it in the database? I am using JAVA.
Share
Don’t use XML for such huge data structures. Since all values are numbers, you can either use CSV (
0,1,1,0,...) or some other, more compact String representation.If the data is guaranteed to be always 0 and 1, you can also use a bit field.
BitSetis not really useful because there is no String->BitSet converter, so you would have to write that yourself.If you don’t want that, try BigInteger.
That gives you large numbers which you can store in the database.