progress looping iterasi

copy array pake arraycopy masih salah, shg gagal karena ada null
solusi : pke if jika array== null , isi dengan angka, misal: nol..
hsil: masih sama, belum kereplace semua..

harusnya 15 berhenti
solusi : buat klasterBanding
boolean banding = false;
int num=1;
Integer[][] klasterLama = new Integer[jumcent][jumdset];
Integer[][] klasterBanding = new Integer[jumcent][jumdset];

do{
sout(“Iterasi ke “+num);
num++;
Integer[][] klasterBaru = new Integer[jumcent][jumdset];
System.arraycopy(klasterBanding, 0, klasterLama, 0, klasterBanding.length);
System.arraycopy(klasterBaru, 0, klasterBanding, 0, klasterBaru.length);
banding = Arrays.deepEquals(klasterBanding, klasterLama);
}while(banding==false);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s