0

I am new at java and I am currently working on a project where I need to do some special work with data. My currently problem is that I have a String matrix [5000][60000] (actually filled with '0' and '1' and I need to transforme this matrix in another with only the index. I am working with huge datasets, but I'll give a small example to make myself clear.

The idea is to read the matrix of string, analyse column by column what is '1' and then put that index (row number) in another matrix of int, as showed next:

String Matrix [2][5]=
0 1 0 0 1
1 0 1 0 1
0 1 1 1 0

I want to transforme this in -> int[][] List = { {2},{1,3},{2,3},{3},{1,2}}

Maybe this is a little basic for this forum, but any help would be very appreciated.

charlesF
  • 3
  • 2
  • Your small example is not valid Java. Please post a small *real* example program. – Hovercraft Full Of Eels Oct 25 '16 at 22:34
  • Also you're comparing Strings wrong. The `==` operation checks for *reference* equality, that the two Strings refer to the very same object, and that's not what matters here. Instead you want to use the String `.equals(...)` or `.equalsIgnoreCase(...)` methods, tests of *functional* equality -- that both Strings hold the same chars in the same order. – Hovercraft Full Of Eels Oct 25 '16 at 22:36
  • I understand the similarities with the other question, but it is not the same thing. I saw that function (equals) but as I understood I cannot choose exactly one character to analyse. – charlesF Oct 25 '16 at 22:46
  • If it's not the same, then please improve your question so we understand it better and can see for ourselves just what it is you need. Your question is very confusing as it is currently written. – Hovercraft Full Of Eels Oct 25 '16 at 22:48

0 Answers0