Could you help me optimize the following fragment of java code please?

For (i=0; i<=9999; i=i+1)
{
for(j=0;j<=9999;j=j+1)
{
if (a[i,j]>0 && b>0)
{
a[i,j]=a[i,j]*2 + b;
}
}
}

Thankyou

also can i just ask, could you tell me the purpose and give short examples of the input/output of the following programs.

1. the LEX in lexical analysis
2. the YACC in syntactical analysis

Thankyou again

It might be easier to optimize once we know what it is that you're trying to do. We can see you're checking every item of a (10 000 x 10 000) table and replacing its value. But what is it for, why are you doing that? If you could give us some more context, we could maybe suggest a totally different approach.

Black Box

I just got some college work and all the teacher gave me was this code- and i had to optimize it, i wasn't sure how to optimize it either.. so any help will do.


Thanks in advance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.