Java Engineering Programs Blog

Booths Algorithm program in java

Booths Algorithm program in java

import java.util.*; class BOOTH { public static int[] add(int a[],int m1[]) { int carry=0; int sum[]=new int [4]; for(int i=3;i>=0;i–) { sum[i]=(a[i]+m1[i]+carry)%2; carry=(a[i]+m1[i]+carry)/2; } return sum; } public static void shift(int a[],int q[]) {...

first fit program in java

first fit program in java

import java.io.*; class firstfit { public static void main(String args[])throws IOException { int n,i,it; DataInputStream in=new DataInputStream(System.in); System.out.println(“Enter Number of Holes”); n=Integer.parseInt(in.readLine()); int sp[]=new int[n]; for(i=0;i<n;i++) { System.out.println(“Enter size of Hole”+(i+1)); sp[i]=Integer.parseInt(in.readLine()); } System.out.println(“Before...

insertion sort in java

insertion sort in java

import java.io.DataInputStream; class InsertionSort { public static void main(String args[ ]) { int i,n=0; int x[]=new int[25]; DataInputStream in = new DataInputStream(System.in); try { System.out.print(“Enter how many numbers to be sorted : “); n...

caesar cipher Program in java

In cryptography Caesar cipher is one of the simple and most widely used Encryption algorithm.Caesar cipher is special case of shift cipher.Caesar cipher is substitution cipher where letter in plain text is replaced by...