Bubble sorting dan Input/Output pake java

May 4, 2011

nyoba2 bubble sorting dan input output pake java.. replace nilai terkecil
input pertama , masukkan nilai integer..
input kedua masukkan nilai bool , true atau false

Foto Pre Wedding Hehehe

Foto Pre Wedding Hehehe


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
*
* @author USER
*/
public class njajal {
public static void main(String args[]){
boolean terus=true;
int angka[]={1,2,3,4,5,0};
int min;
int y=1000;
int indMin=5;
while (terus)
try {
y=1000;
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
for (min=0;min<angka.length;min++){
if (angka[min]1; out–) // outer loop (backward)
for(in=0; in<out; in++) // inner loop (forward)
if( angka[in] < angka[in+1] ) // out of order?
{
int temp=angka[in];
angka[in]=angka[in+1];
angka[in+1]=temp;
}

for (int x=0;x<angka.length;x++){
System.out.println(angka[x]);

}

} catch (IOException ex) {
Logger.getLogger(njajal.class.getName()).log(Level.SEVERE, null, ex);
}
}
}

coding2 sebelum berangkat…

One Response to “Bubble sorting dan Input/Output pake java”

  1. arkan Says:

    keren lal..
    terus banyakin tutorial..


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

%d bloggers like this: