Buggy code:
public class WuKongSystemFactory { private int landMarkNumber ; private int classNumber ; private int deviceNumber ; private int distanceRange ; private int K ; public WuKongSystemFactory ( int classNumber , int deviceNumber , int landMarkNumber , int distanceRange ) { } public WuKongSystemFactory ( int classNumber , int deviceNumber , int landMarkNumber , int distanceRange , int K ) { } public WukongSystem createMultiHopWukongSystem ( int k , int replica , TYPE type ) { } public WukongSystem createRandomWukongSystem ( int k , int replica ) { } private WukongSystem createWukongSystemWithDistance ( int K , int replica , Double [ ] [ ] distances ) { if ( ( replica * ( classNumber ) ) >= ( K * ( deviceNumber ) ) ) { System . out . println ( "Not<seq2seq4repair_space>creatable" ) ; return null ; } WukongSystem system = new WukongSystem ( ) ; List < WuDevice > devices = new ArrayList < WuDevice > ( ) ; Random ran = new Random ( ) ; int [ ] globalClassMap = new int [ classNumber ] ; Arrays . fill ( globalClassMap , 0 ) ; int [ ] classMap = new int [ classNumber ] ; for ( int i = 0 ; i < ( deviceNumber ) ; i ++ ) { List < Integer > objectIds = new ArrayList < Integer > ( ) ; WuDevice device = new WuDevice ( ( i + 1 ) , Double . MAX_VALUE , objectIds , getRandomDistance ( landMarkNumber , distanceRange ) , new ArrayList < Double > ( Arrays . asList ( distances [ i ] ) ) , system ) ; devices . add ( device ) ; } for ( int i = 0 ; i < ( classNumber ) ; i ++ ) { while ( ( globalClassMap [ i ] ) < replica ) { ran . setSeed ( ( ( System . nanoTime ( ) ) + ( i * i ) ) ) ; int deviceId = ( Math . abs ( ran . nextInt ( ) ) ) % ( deviceNumber ) ; if ( ! ( devices . get ( deviceId ) . isWuObjectExist ( i ) ) ) { if ( ( devices . get ( deviceId ) . getAllWuObjectClassId ( ) . size ( ) ) < K ) { devices . get ( deviceId ) . addWuObject ( i ) ; ( globalClassMap [ i ] ) ++ ; } } } } for ( int i = 0 ; i < ( deviceNumber ) ; i ++ ) { Arrays . fill ( classMap , 0 ) ; List < WuObject > objectIds = devices . get ( i ) . getWuObjects ( ) ; for ( WuObject objectId : objectIds ) { ( classMap [ objectId . getWuClassId ( ) ] ) ++ ; } while ( ( ( devices . get ( i ) . getWuObjects ( ) . size ( ) ) < K ) || ( ( devices . get ( i ) . getWuObjects ( ) . size ( ) ) == 0 ) ) { ran . setSeed ( ( ( System . nanoTime ( ) ) + ( i * i ) ) ) ; int classId = ( ( Math . abs ( ran . nextInt ( ) ) ) % ( ( classNumber ) - 1 ) ) + 1 ; if ( ( classMap [ classId ] ) < replica ) { devices . get ( i ) . addWuObject ( classId ) ; ( classMap [ classId ] ) ++ ; } } } <START_BUG> system . initialize ( devices , distances , classNumber , landMarkNumber ) ; <END_BUG> return system ; } public WukongSystem createRandomWuKongSystem ( ) { } public WukongSystem createRandomMultiProtocolWuKongSystem ( int numberChannel ) { } public List < Double > getRandomDistance ( int landMarkNumber , int distanceRange ) { } public Double [ ] [ ] getDistanceMatrixBasedOnGraph ( SimpleDirectedGraph < Object , DefaultEdge > graph , int distanceRange ) { } public Double [ ] [ ] getRandomDeviceDistanceMatrix ( int deviceNumber , int distanceRange ) { } public int [ ] [ ] getRandomDeviceChannelMatrix ( int deviceNumber , int channelNumber ) { } }

Fix:
system . initialize ( devices , distances , false , classNumber , landMarkNumber ) ;