private void setTraces ( ) { int pointers [ ] = new int [ 4 ] ; //alphabetical, 0=A, 1=C, 2=G, 3=T int datas [ ] = new int [ 4 ] ; char order [ ] = new char [ 4 ] ; datas [ 0 ] = DATA9 ; datas [ 1 ] = DATA10 ; datas [ 2 ] = DATA11 ; datas [ 3 ] = DATA12 ; for ( int i = 0 ; i <= 3 ; i ++ ) { order [ i ] = ( char ) traceData [ FWO + i ] ; } for ( int i = 0 ; i <= 3 ; i ++ ) { switch ( order [ i ] ) { case ' ' : case ' ' : pointers [ 0 ] = datas [ i ] ; break ; case ' ' : case ' ' : pointers [ 1 ] = datas [ i ] ; break ; case ' ' : case ' ' : pointers [ 2 ] = datas [ i ] ; break ; case ' ' : case ' ' : pointers [ 3 ] = datas [ i ] ; break ; default : throw new IllegalArgumentException ( "Trace contains illegal values." ) ; } } A = new int [ traceLength ] ; C = new int [ traceLength ] ; G = new int [ traceLength ] ; T = new int [ traceLength ] ; for ( int i = 0 ; i <= 3 ; i ++ ) { byte [ ] qq = new byte [ traceLength * 2 ] ; getSubArray ( qq , pointers [ i ] ) ; DataInputStream dis = new DataInputStream ( new ByteArrayInputStream ( qq ) ) ; for ( int x = 0 ; x <= traceLength - 1 ; x ++ ) { try { if ( i == 0 ) A [ x ] = ( int ) dis . readShort ( ) ; if ( i == 1 ) C [ x ] = ( int ) dis . readShort ( ) ; if ( i == 2 ) G [ x ] = ( int ) dis . readShort ( ) ; if ( i == 3 ) T [ x ] = ( int ) dis . readShort ( ) ; } catch ( IOException e ) //This shouldn't happen. If it does something must be seriously wrong. { throw new IllegalStateException ( "Unexpected IOException encountered while manipulating internal streams." ) ; } } } return ; }
Shuffle the pointers to point to the proper spots in the trace then load the traces into their arrays .