Complex numbers string/array in java? -
i want assign complex numbers binary values doing using complex class, available; when appending complex numbers string buffer, returning string, 1 complex number taking multiple entries. how can place 1 number 1 entry , read afterwards? ending string data "2.0+2.0i2.0-2.0i2.0+2.0i2.0-2.0i-2.0+2.0i2.0+2.0i....". character @ 0 '2', char @ 1 '.' , on.. need char @ 0 2.0+2.0i. , afterwards should able separate real , imaginary parts of each entry.
stringbuilder symbs = new stringbuilder(); complex s1 = new complex(-2,-2); complex s2 = new complex(+2,-2); complex s3 = new complex(+2,+2); complex s4 = new complex(-2,+2); /////////////////////symbols vector //////////////////// for(int i=0; i< plo.length()-1; i+=2) { if(plo.charat(i)=='1' && plo.charat(i+1)=='0') { symbs.append(s1); } else if(plo.charat(i)=='0' && plo.charat(i+1)=='1') { symbs.append(s2); } else if(plo.charat(i)=='0' || plo.charat(i+1)=='0') { symbs.append(s3); } else if(plo.charat(i)=='1' && plo.charat(i+1)=='1') { symbs.append(s4); } } printcomplex(symbs.tostring());
"i need char @ 0 2.0+2.0i." thats not possible, char 1 character.
you can append semicolons after every complex , split them
Comments
Post a Comment