The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

Help with Fast Matrix Exponentiation

hey everyone,

I feel like I am close to the answer, but I'm just missing something little. What I'm supposed to do, basically, is come up with a program that allows me to increase matrices exponentially. My problem lies when I want to do anything higher than a power of two. For example, when I raise it to the power of 3, it does it by 4 instead. If I do it by 4, it does it by 6. Can anyone help me? I feel like it's something small that I am overlooking, but I am not able to figure it out.