Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8441229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:30:50+00:00 2026-06-10T08:30:50+00:00

I am very new to Java (and programming in general, my previous experience is

  • 0

I am very new to Java (and programming in general, my previous experience is with ActionScript 2.0 and some simple JavaScript), and I am working my way slowly and methodically through Java: A Beginner’s Guide by Herbert Schildt. It is an incredible book.

For one thing, I finally understand more-or-less what bitwise operators (which I first encountered in ActionScript 2.0) do, and that they are more efficient than other methods for certain sums.

My question is, is it more efficient to use a method that uses, say, a shift right, to perform all your divisions/2 (or divisions/even) for you in a large program with many calculations (in this case, a sprawling RPG), or is it more efficient to simply use standard mathematical operations because the compiler will optimise it all for you?

Or, am I asking the wrong question entirely?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:30:52+00:00Added an answer on June 10, 2026 at 8:30 am

    You are asking the wrong question entirely. The question you should be asking is “should I keep my code simple and readable, or use tricks that I believe will improve its performance, even though I haven’t measured its performance.” The answer should be obvious.

    Bitwise operators have their place, especially when you’re dealing with binary file formats that need to pack a lot of data into small space. And it’s absolutely critical to know how to mask out the high bits of a byte so that you don’t accidentally sign-extend (print out these two variables to see what I mean):

    byte b = (byte)0xDC;
    int  i = b & 0xFF;
    

    But don’t go looking for places to use these operators, especially to replace such simple tasks as dividing by 2.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a small Java applet, very much new to this programming thing.
i'm doing some exercises in my Java book. I'm very new to programming. Therefore,
i am very new to programming in java however have a lot of experience
I'm very new to Java programming language so this is probably dumb question but
I am very new to Java as well as Android programming. I was attempting
I am very new to this site and to programming. I started doing some
I am very new to programming and I am using Java as my first
I'm very new to Java programming, and this is actually part of a problem
I'm fairly new to Android programming and to Java in general, but I have
I am new to Java Applet programming and Java in general but I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.