Category: Computer organization and architecture

Computer organization and architecture program in java

RESTORING Division program in java

RESTORING Division program in java

import java.util.*; class RESTORING { public static void lshift(int a[],int q[]) { for(int i=0;i<3;i++) { a[i]=a[i+1]; } a[3]=q[0]; for(int i=0;i<3;i++) { q[i]=q[i+1]; } q[3]=0; } public static int[] add(int a[],int m1[]) { int carry...

non restoring division algorithm in java

non restoring division algorithm in java

import java.io.*; class NONRESTORING { public static int[] lshift(int s1[],int s2) { int s[]=new int [4]; for(int i=0;i<3;i++) { s[i]=s1[i+1]; } s[3]=s2; return(s); } public static int[] add(int A[],int B[]) { int s[]=new int...

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[]) {...

bankers algorithm program in java

bankers algorithm program in java

import java.util.*; class Bankers { int claim[][],alloc[][],av[],need[],p,r,alsum[],sum,temp[][]; int a=0,b=0,c; boolean flag; Scanner src = new Scanner(System.in); Bankers(int p,int r) { this.p=p; this.r=r; claim=new int[p][r]; alloc=new int[p][r]; av=new int [r]; need=new int [r]; alsum=new int[r];...