need help with math for a new program

As the title says, I need help with the math involved for my next program idea. My idea has probably already been done, but I want to make my own in Java anyway (also to provide a resource to look up the formula offline). What the program is supposed to do is take the Gigabytes value given by the user and convert it into the binary equivalent. Through a bit of testing with a openoffice spreadsheet, I came up with the formula a=(GB*10^9)/1024^3 (using my computer's hard drive info for comparison and editing accordingly). I know that I'll be using Math.pow() or something similar (I can get that info from the books I have), so I'm aware the formula will look different in Java. in this formula, "a" stands for actual. Is the formula that I came up with accurate enough or is there a better formula?