MEHULecs DIKSHITecs

Greenhorn
+ Follow
since Nov 20, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by MEHULecs DIKSHITecs

//FileReader fr =new FileReader(fileName);
//BufferedReader br2 = new BufferedReader(fr);
System.out.println("Please enter the string you would like to locate:");
input = br.readLine();
System.out.println(fileName + " " + input);
total = 0;
BufferedReader reader = new BufferedReader(new FileReader(fileName));
String readLine = reader.readLine();
System.out.println("There were matches at:");

while ( readLine != null )
{
System.out.println(readLine);
st = new StringTokenizer(readLine, input);
//next = st.nextToken();
//charCount = charCount + next.length() + 1;
//lineCount = lineCount + 1;
while ( st.haToken() )
{
total++; // if coffe is is available then count++
//if (next.equals(input))
//{
//System.out.print("Line:" + lineCount + "\nColumn:" + charCount);
//}
}
readLine = reader.readLine();
}
System.out.println(total);
20 years ago
Hi chandra
Try putting System time in miillis before and after the code where
you actually fetch data from RS for adding to ArrayList.
You will find the java itself takes lot of time in retriveing data from RS
This slows your process there is not much you can do about it
/*
class Prime
Input
The maximum integer upto which primes have to be generated
Output
The prime integers each separated by a white space and ending with
a new line character
Algorithm
1) Instantiate a list of max integers with initial value 0
2) Start at the first number say "i" on the list
which has not yet been considered(should not start from 1)
3) Check if the value of the ith element in the list is 1
if it is 1 increment i otherwise proceed to step 4
4) Set all numbers of the list which are multiples of i to 1
Increment i and go back to step 2
*/
class Prime
{
public void computePrime(int max)
{
int [] intArr = new int[max+1];//Array of integers. For convenience we are making an array of max + 1 instead of max
for(int i = 2; i <= max; i++)
{
if (intArr[i] != 1)
{
System.out.println(i);
for(int j=2*i; j <= max; j+=i)
intArr[j] = 1;
}
}
}
public static void main(String [] args)
{
int max = 50;// Max num upto which primes have to be generated
Prime prime = new Prime();
prime.computePrime(max);
}
}
Try this and solve few errors if any
20 years ago
public class DSInfoDlg extends JDialog
{
super (fParent, RM.getString(R_designer.DLGT_DS_INFO));
setModal (true);
setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
}
This works fine but the [X] button in title bar for window closing shows as enable. This creates a doubt to the user who may use this work of mine as to why the window is not closing.
I wanted to know if we can disable (totally remove) this button in the title bar.
please help me out in this.
Regards
Mehul