/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package array;
/**
*
* @author ashwin
*/
public class Array
{
public long[] a;
public int n;
public Array(int max)
{
a=new long[max];
n=0;
}
public void insertelement(int value)
{
a[n]=value;
n++;
}
public void display()
{
for(int j=0;j<n;j++)
{
System.out.print(a[j] + " ");
}
System.out.println();
System.out.println();
}
public void bubblesort()
{
int out,in;
for(out=n;out>1;out--)
{
for(in=0;in<out;in++)
{
if(a[in]>a[in+1])
{
swap(in,in+1);
}
display();
}
}
}
public void swap(int one,int two)
{
long temp=a[one];
a[one]=a[two];
a[two]=temp;
}
}