1. How do I convert a decimal fraction to binary in Java? stackoverflow.comI need to convert 0.5 in base 10 to base 2 (0.1). I have tried using
and it returns 4602678819172646912 which I guess is in hex, but it does not make ... |
2. built-in Java classes/methods to convert between binary, decimal, and octal? stackoverflow.comi know of several general formulas for converting between binary, decimal, and octal, but i was wondering if java has any built-in methods or classes that convert between the three. for ... |
3. Conversion from exponential form to decimal in Java stackoverflow.comI want to convert exponential to decimal. e.g. 1.234E3 to 1234. |
4. converting Binary Numbers in to decimal numbers stackoverflow.comI need a program to convert Binary numbers into Decimal number in Java or in C++. is there some one who can help me. |
5. Convert scientific notation to decimal notation stackoverflow.comThere is a similar question on SO which suggests using NumberFormat which is what I have done. I am using the parse() method of NumberFormat.
|
6. How to convert degree minutes second into decimal in java stackoverflow.comThis is a basically gps application where i am getting the latitude information from the meta data of a picture in this format 28"41'44.13597 . My need is to convert the ... |
7. Java - Convert boolean[] to decimal stackoverflow.comA boolean array can be considered to be a binary number e.g.
I would like to convert such an array to its decimal equivalent e.g.
|
8. conversion decimal to 2^12 binary form stackoverflow.comanyone can help me how to convert a decimal number into 2^12 binary form...here the code that i used for conversion. bt it's not 2^12 binary for. pls do anyone help ... |
9. What's the best way in Java to calculate a partial decimal value from parts of a 32-bit value stackoverflow.comI have a 32-bit integer value and I want to translate that into two decimal values. One value from the 5 least significant bits and one decimal value from the rest ... |
10. What kind of number is aa568 and how do I convert to it from decimal in Java? stackoverflow.comI assume |
11. decimal to binary converter stackoverflow.comI would like to create a piece of code in java that will convert a decimal value to binary without using an in-built binary converter command. But it doesn't work...
|
12. Convert Decimal Degrees or Degree Minutes Seconds to Meters in Java stackoverflow.comI am working with a GIS project. Right now I have code to convert decimal degrees to degree/minute/seconds, but I don't have any idea how to convert decimal degree or ... |
13. In Java how do you convert a decimal number to base 36? stackoverflow.comIf I have a decimal number, how do I convert it to base 36 in Java? |
14. In Java how do you convert a base 36 number to a decimal number? stackoverflow.comGiven the base 36 number YPAYPA, is there a library function in Java that would convert this to a decimal number? |
15. swap big endian java then to decimal stackoverflow.comLittle confused on the whole big endian, little endian thing even after reading up on it. Say I have a Hex value of...
and I ... |
16. Converting decimal to binary in Java stackoverflow.comHey guys! I want to study Java by myself, so i'm doing my baby steps right now. It's amazing how you can have everything on the web, But anyway I'll be glad for ... |
17. How Can I Convert Very Large Decimal Numbers to Binary In Java stackoverflow.comFor instance, How would I be able to convert |
18. how to Convert double's exponetial form to normal decimal form stackoverflow.comAll Experts I am doing some logical stuff in my program with an variable of type double. everything is Ok when the value of type double parameter is less then 1,00,00,000. But when ... |
19. Converting numeric value with currency symbol back to Decimal with NumberFormat stackoverflow.comI would like to convert a possibly Decimal value prefixed with currency symbol into only numeric value.
|
20. Decimal conversion stackoverflow.comI am trying to set decimal values,Below is my input string
Converting to double:
I dont understand how to do ... |
21. Convert a large 2^63 decimal to binary stackoverflow.comI need to convert a large decimal to binary how would I go about doing this? Decimal in question is this 3324679375210329505 |
22. convert millisecond with decimal into millisecond stackoverflow.comIn Midi timing, I have calculated to convert MIDI time to millisecond but contains decimal numbers (e.g. 2000.5454545454). To reduce the loss of precision, what is the best solution to convert ... |
23. How to convert binary string value to decimal stackoverflow.comHow to convert string c="110010"; (as binary) To the value in decimal ? (res=50) I work on java on android |
24. Converting 32 bit hexadecimals to decimal in java stackoverflow.comfor an assignment I have to write a program that will take in an 8 character string(hexadecimal) and then convert it to base 10. I am not allowed to use any ... |
25. Efficient way to convert a hex representation of a number to a decimal value stackoverflow.comI have a byte[5] array which represents a decimal number when printed as a hex string. Two digits can be stored in one byte, the hex characters are not used. E.g.
|
26. how to convert between degrees, minutes, seconds to Decimal coordinates stackoverflow.comLooking for a java utility. It is even better if you can tell me how to do it using geotools library. |
27. help converting Roman to decimal in java bytes.comromanNumeral = JOptionPane.showInputDialog("Enter a Roman numeral to convert to decimal." + "\n\n"+ "Note: Roman numerals are I, V, X, L, C, D and M."+ "\n" + "All letters entered ... |
28. Simple Calculator to Convert Decimal to Hexadecimal bytes.comThis is obviously a homework problem. I suggest you read our Posting Guidelines on Homework Questions. So, all I can suggest for your second question is to consult your textbook or ... |
29. numberformatException when i convert from string to decimal bytes.comWe can not make out what's wrong with the code and why this exception is thrown. Please post the code which is causing this exception. Regards Dheeraj Joshi |
30. how do I make a binary to decimal converter? bytes.com |
31. Convert hex to decimal value coderanch.comHi there, I have a buffer of 4 bytes long. These four bytes together store a hex value of file size. The code below was written is C and it works. char *ptr; unsigned long fileSize = (( unsigned char ) * (ptr+24) * 256 * 256 * 256 ) + (( unsigned char ) * (ptr+23) * 256 * 256 ... |
32. conversion from decimal to packed BCD coderanch.comHi, welcome to the ranch! I'm not aware of anything to do that, but you could Google and see. I haven't looked to see the real definition of BCD ... are you converting to/from IBM mainframes where 123 would be, um, x'f123'? We've had other questions about that in the past ... you might try the ranch search tool on the ... |
34. converting a decimal value to a character .. How ? coderanch.com |
35. Converting Octal, Hex and Decimal coderanch.com |
36. Convert decimal to binary coderanch.comTrying to understand what happens when converting from decimal to binary. I understand how to get a positive number to binary, but a negative decimal number is throwing me off. The number I am using is -42. I have illustrated a positive 42 below. Can someone help me understand what is happening? ... 128 64 32 16 8 4 2 1 ... |
37. Conversion of negative binary number to decimal number coderanch.com |
38. convert negative decimal number to binary coderanch.comDo you mean with two's complement representation of -ves? You'll have to decide that before you work on the conversion. If you do, you could cheat and look at the source of Integer.toBinaryString: public static String toBinaryString(int i) { return toUnsignedString(i, 1); } /** * Convert the integer to an unsigned number. */ private static String toUnsignedString(int i, int shift) { ... |
39. Converting Hex to decimal - with a twist coderanch.comI'm thinking if it starts with F then XOR the string, do the parserInt() bit, flip the sign and subtract 1. XOR the string is interesting ... gotta translate F=0 E=1, D=2 ... 0=F. This is real ugly but seems to work: public class Bogus { public static void main(String[] args) { String input = "FFFB6825"; char[] c = new char[] ... |
40. Hexadecimal and decimal convert code coderanch.comHere's a 'manual' way for args[] enter eg 24032 10 16 or 5DE0 16 10 class Conversions { public static void main(String args[]) { String converted = convert(args[0],Double.parseDouble(args[1]), Double.parseDouble(args[2])); System.out.println(args[0] + " (base "+args[1]+")"+ " converts to "+converted+ " (base "+args[2]+")"); System.exit(0); } private static String convert(String oldNum,double base1,double base2) { long temp=0; int x = 0; String nextChar; String convertedNumber ... |
41. How to convert binary to decimal? coderanch.comHi, The binary conversion utilizes an exponent, so you could use a method pow() from Math class in java.lang [Math.pow()] or make up your own logic. Make sure you understand the conversion a binary number with positions 7654 3210 <-- position 1101 0111 == 1 * 2 to the 7th + 1 * 2 to the 6th + 0 * 2 ... |
43. Converting binary to decimal coderanch.comIt's best if you start with an example you can work out by hand. You can examine what happens and write code to accomplish it. Then you have a test case to use to give you an idea of whether it works or not. It's generally good to have several test cases. As an example, consider convert 1010 to decimal. Each ... |
44. How to convert exponential value to decimal form coderanch.com |
45. Convert Decimal to Binary No. coderanch.comHi, I am using this method to convert the decimal number, 75 to a binary no. Could you pls help me? With the given algorithm, I am getting 1001001. But the actual answer is 1001011. I am uncertain as to why I am deriving to the value. Please show me if you have some algorithm that works. Appreciate your speedy response. ... |
46. converting decimal number to roman number coderanch.comI guess you would first of all want to figure out the major building blocks I = 1, V = 5, X = 10, etc., Then you would want to figure out how to replace these numbers with their corresponding letters. I would have thought that your best bet would be to try doing something with numbers that can be divided ... |
47. Convert decimal number in words coderanch.com |
48. Packed decimal conversion - Java coderanch.comBy packed decimal, I assume you mean a number with 2 decimal digits per byte except for the ending byte which has the sign in the last nibble. I forget what valid sign values are, could be C, D and F?? For example given 2 bytes: the value of 010F would be 10, 023D would be -23 If you read the ... |
49. Converting long hexadecimal strin to decimal coderanch.comI have the following code to convert a hexadecimal string to its decimal equivalent : public static void hexadecimalToDecimal(String hex) throws NumberFormatException { // Consider each digit in the string for (int i = 0; i < hex.length(); i++) { // Get the nth char from the right (first = 0) char n = hex.charAt(hex.length() - (i+1)); int f = (int) ... |
51. conversion of binary and hex to decimal and about left/right shift coderanch.comhow to convert a hex or binary number to decimal and vice versa using a any java mehtod, can any one help. and one more thing that can any one explain how computer store and retrieve - sign . i am so much confusd with left and right shifts i have mentioned 2 codes here. 1). our input variable "int num ... |
52. doubt in a program of convert decimal to Hexadecimal-please clarify coderanch.comHello, i am making a program of convert decimal to Hexadecimal. please write what is difference between these programs. public class DeciToHexa1 { public static String Dhexadecimal(int w) { int rem; String output=""; String digit; String backwards=""; do { rem=w%16; digit=DtoHex(rem); w=w/16; output+=digit; } while(w/16!=0); rem=w%16; digit=DtoHex(rem); output=output+digit; for(int i=output.length()-1; i>=0; i--) { backwards+=output.charAt(i); } return backwards; } public static String ... |
53. How to convert String to float with exact decimal value coderanch.comHi, When I convert a String value to float by using Float.valueOf(String), The return value is not containing last decimal. Ex: String a = 2.50; float b = Float.valueOf(a); Now the float "b" is holding only upto 2.5. It is not converting String value to float properly. My requirement is to convert a String value to Float with exact decimals. Please ... |
54. Convert Hex To Decimal coderanch.com |
55. Binary to decimal converter coderanch.comHi guys.got some problem in this program.Was suppose to write a program to get a binary string and display its value. Need to have 3 methods. binaryToDecimal() -Receive string which represents the value -Converts the binary value to decimal -Return results validateInput() -Receive string as parameter -Return true if string contains 0s and 1s,false otherwise main() -Read input using scanner class ... |
56. How to retain decimal precisions after converting from String to double coderanch.comHi, I have a string value "1.0000" and i want to convert it into double to write to the excel. When i convert from string to double, i got value as 1.0; Is there any way that we can retain the precisions same as string after converting from string to double? Please let me know. |
57. convert a string having decimal point to double or long coderanch.comHello, I was trying to convert a string having decimal in it to long or double for that matter..ParseInt method was giving me number format exception since it was not able to resolve decimal point in it right? Should i use a delimiter?? Please do suggest.. String abc="123.00"; int a=Integer.parseInt(abc);------ this wont work obviously.. String result = String.format-----> but i was ... |
58. Binary to Decimal conversion coderanch.comHi, The program below takes input from the user binary values, reads them as a string and converts the same to decimal using the 'Integer' wrapper class. Issue-faced: I've used the while loop to take subsequent user inputs and to terminate the program on user entering exit. As the string "exit" is converted to base 10 values (whereas the Integer.parseInt() is ... |
59. Convert decimal value to binary coderanch.comHi, My program takes input from the user a decimal value & converts to the corresponding binary one by using the "comparison with descending powers of 2 and subtraction" method Program import java.io.*; import java.lang.*; import static java.lang.Math.*; import java.util.Scanner; import java.util.*; public class TestDecimal2Binary { public static void main(String[] args) { int decimal = 0; int p = 0; System.out.println("Enter ... |
60. Making a binary to decimal converter coderanch.comHey, I'm trying to make a binary to decimal converter, using a loop, for example if I were to enter 101, it would give me a value of 5, so far I have: import java.util.Scanner; public class BinaryCounter { public static void main (String [] args ) { System.out.println ("Enter a number in base 2 format."); Scanner kb = new Scanner(System.in); ... |
61. how to convert decimal value into 8-bit binary value java-forums.org |
62. Convert binary into decimal java-forums.orgHey people. Ok to be honest I don't even know where to begin on this one. I have pieces of knowledge all over the place but I can't seem to put any of it together. I taught myself how to do binary to decimal conversion on paper using the "convert from binary to decimal wiki how" tutorial. I don't need you ... |
63. Binary to Decimal Converter java-forums.orgHi everyone. I need help with my Java program. I was tasked to create a program that converts an inputed 16-bit, 2's complement binary or hexadecimal number into decimal number. Included in the input is the 0b and 0x to indicate whether its binary or hexadecimal. The main rule for the program is that I only have to use the String ... |
64. Convert Decimal To Binary java-forums.orgi have the code: import java.io.*; public class Convert{ public static void main(String args[]) throws IOException { int a[] = {0, 1}; int number; int r; BufferedReader Input = new BufferedReader( new InputStreamReader(System.in)); System.out.println(); System.out.print("Enter Decimal Number: "); number = Integer.parseInt( Input.readLine()); System.out.println(); do{ r=number%2; if(r > 0){ System.out.println(a[1]); //prints the binary 1 } else{ System.out.println(a[0]); //prints the binary 0 } ... |
65. convert characters to its equivalent value in decimal and hexadecimal java-forums.orgBasically, i'm trying to create a panel where it can convert char to hex value and decimal value. I'm a beginner in java, my actionlistener doesn't seem to work :( Can i convert character to integer directly by using Character.getNumericValue() ? :confused: Java Code: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class CharConverterPanel extends JPanel { private JLabel Insert, Base, Eq, ... |
66. Converting whole number into decimal java-forums.orgIn one of my class exercises, I have to write a program that reads certain employee information and prints a payroll statement. I have to write it once using dialog boxes for input/output and again using console input/output. One of the fields is the federal tax withholding rate. I have it set up so that I can enter a number (i.e., ... |
67. Converting characters to decimal to binary java-forums.orgI didn't really get it by modding but I guess what I did works well enough, even if it is kinda stupid. So here's what I got now. Java Code: Scanner input = new Scanner(System.in); String textString = ""; int sixtyFoursPlace = 0; int thirtyTwosPlace = 0; int sixteensPlace = 0; int eightsPlace = 0; int foursPlace = 0; int twosPlace ... |
68. convert to decimal java-forums.orgHi friends, i have a set of ascii data's i.e.,(cp437) format.. i want to convert these ascii values to decimal.. is this possible to convert. String asciicp437 = "d~" // (cp437 or IBM437) am tried the normal concept but i didn't work.. here is my code String asciicp437 = "d~<"; for(..........) { char ch = asciicp437.charAt(i); int a = (int)(ch); String ... |
69. Advice On First Program (binary to decimal converter) java-forums.org |
70. binary to decimal converter java-forums.orgI need help with a basic program, I'm trying to convert a binary number, to a decimal, EX: 101 would become 5, this is my program so far, can anyone help me with it? For some reason, it asks me for a number twice, and an error. x is the index reading, because the first digit is 2^0, and the second ... |
71. problem of negative sign in conversion of hexadecimal to decimal. forums.oracle.com |
72. IEEE 754 32 bit Hexadecimal to decimal conversion forums.oracle.comHi, I have an interesting problem at hand to convert IEEE 754 32 bit Hexadecimal to decimal. For example if i have 48C35000 in Hexadecimal format need to convert it to decimal which will have a resulting value of 400000.0, so on and so forth. I have this nice applet that does the conversion for me http://www.h-schmidt.net/FloatApplet/IEEE754.html. Some more information regardring ... |
73. do anyone know how to convert a decimal to binary, 1 into 01 forums.oracle.comdo anyone know how to convert a decimal to binary i wants to convert 1 into 01, but the computer print out 1, it didn't print 0 also 0 it also print only 0, and 3 it print11 so decimal of 3, the computer print correct, but 0 and 1 it print wrong how can i print 01 if my decimal ... |
74. Convert a binary addition into a regular decimal number forums.oracle.comThe problem sounds poorly phrased. Apparently, what you're doing is getting a string of user input, which represents a binary number, but reading it as an int. Then you're converting that int into another int. But the int you've read in isn't really binary, any more than the number you produce is binary. (They're both binary in that they're stored in ... |
75. Doubt on Hex to decimal conversion forums.oracle.comin katthy sierra 1.5 book page # 177 there is a code for hexadecima literals. the code goes this way: class HexTest { public static void main (String [] args) { int x = 0X0001; int y = 0x7fffffff; int z = 0xDeadCafe; System.out.println("x = " + x + " y = " + y + " z = " + ... |
76. program to convert binary to decimal number? forums.oracle.comI think you can do this by using the java.lang package since it provides the facility to convert the integer data into the binary to decimal. Also, you may use the parseLong() method to parse the string argument as a signed decimal long. By the way, the type of loop you need is a while loop. If anything, ask more questions. ... |
77. Convert any base number to decimal forums.oracle.comSystem.out.print("Enter the number in base : "); number = scanner.next(); if (scanner.hasNext()) { // not sure how to validate in relation to entered base } else { System.out.println("Invalid number. Please retry"); return; } int decimalValue = 0; int step = 0; for (int i = number.length() - 1; i >= 0; i--) { char c = number.charAt(i); int cValue = Character.digit(c, ... |
78. convert degrees to decimal equivalent forums.oracle.com |
79. How to convert given celsius (decimal values) to 3 numeric characters???? forums.oracle.comHi, I'll be getting a celsius value from the user. The value may be -14.78 (0r) -14.7778 (or) -14.4445 (or) -1.122 I need to truncate to round to 3 numeric values (3 numeric characters is must). Ex: Input Output -14.78 --> -14.8 -14.7778 --> -14.8 -14.4445 --> -14.0 Also - important scenario, -1.122 --> -01.0 (Before 1 zero should come since ... |
80. Need Help With Binary To Decimal Converter forums.oracle.comAs others have said, I'd have to agree you need to figure out how to use a loop. I haven't looked at any of your previous posts, but, trust they have. But, just by looking, I think the if/then you do when setting the decimal numbers is wrong. You are comparing to ==16 both times. I think one of them maybe ... |
81. convert from decimal number to binary number forums.oracle.com |
82. Need help with my Code - Converting decimal to binary. forums.oracle.com |
83. Convert non-ASCII character to decimal value forums.oracle.comHi all, I have the following problem: When reading a String containing the full spectrum of UTF-8 characters from a BufferedReader: How can I get the decimal value of the String's characters outside the ASCII range? When I try to do a MyBufferedReader.read(), I get the int value 65533 for these characters, instead of their real value in the UTF-8 set. ... |
84. Binary to Decimal Conversion forums.oracle.comimport java.awt.Color as CL import javax.swing.border.BevelBorder import javax.swing.SwingConstants as SC import javax.swing.WindowConstants as WC import groovy.swing.SwingBuilder import net. miginfocom.swing.MigLayout def swingB = new SwingBuilder() def migLayout = new MigLayout(layoutConstraints: 'fill') def doConvert = {event -> def imperialText = swingB.imperialTextField.text def imperialMeasure = imperialText.toDouble() def metricMeasure = 2.54* imperialMeasure def metricText = metricMeasure.toString() swingB.metricTextField.text = metricText } def doExit = { event ... |
85. convert decimal to binary with a fixed length forums.oracle.comHi, I need to write a program that converts a decimal number to binary with a fixed length (say 5), for example, decimal digit "0" -> binary number "00000". I try Integer.toBinaryString(), but it will just cut off the leading bits, so I wonder how to let the conversion happen, anyone can help me with that, thanks in advance. mckie |
86. Need help to convert - decimal representation to fractional forums.oracle.comHello Friends, I need help to convert decimal representation to fractional, I have done the enough googling to do this. Actually, I have to convert 95 1/2 or 98 7/8 or 103 17/32 into fractional and If passed argument cannot be represented as n/32 fraction then the function should throw IllegalArgumentException. This is basically for converting US bond price from decimal ... |
87. Convert Hex character string to decimal forums.oracle.com |
88. How to convert scientifc exponential number to Decimal? forums.oracle.com |
89. converting decimal to binary and vice versa(with huge numbers) forums.oracle.comI need to convert a decimal number, represented as a string, to a binary number, preferably also represented by a string. These numbers will probably become much bigger then something a long, or even a double could handle, so the build-in methods for conversion fail... Anyone got an idea on how I could begin to solve this? |
90. how do i convert decimal to binary? forums.oracle.com |
91. Converting decimal to binary? forums.oracle.comthanks guys; i think result += ""+rem; is right...this is a class assignment, in which i get the general idea of how to convert (keep dividing the number by 0 and the remainders produce the binary number). the only problem i don't understand is how to actually get these remainders to return them in the method; i know they exist, but ... |
92. Convert Decimal to Hexadecimal & other conversions forums.oracle.comYou convert those steps procedurally - so for the decimal to binary one you could maybe have some sort of a loop that runs until the division is complete - each time printing the result to an array? Then you could have some method that reverses the Array to give you your binary. You have to think outside the box a ... |
93. How to convert String to Decimal? forums.oracle.comI have the following code: I'm creating a new object from a Struts form fields to use later in business logic to update a database table: transferObject = new PropertyHolder(wbasForm.getStrFundCode(),wbasForm.getCountyCode(), wbasForm.getStrFundName(),wbasForm.getStrAgrNum(), new BigDecimal(wbasForm.getPrtRate()), new BigDecimal(wbasForm.getFltRate()), wbasForm.getEffDate(),wbasForm.getStrExpDate()); I have two form fields: prtRate and fltRate when executing new BigDecimal(wbasForm.getPrtRate()) having 880.00 as a parameter to PropertyHolder class everything works fine and program ... |
94. Converting Hexadecimal String to decimal forums.oracle.comint count = 16; int a = 0; int first = 1; int second = 16; int result = 0; for (int i = 0; i < s.length(); i++){ count = count * 2; a++; if (s.charAt(i) == '1') a = 1; if (s.charAt(i) == '2') a = 2; if (s.charAt(i) == '3') a = 3; if (s.charAt(i) == '4') a ... |
95. need help in converting decimal, binary, octal, and hexadecimal numbers forums.oracle.com} } Ignore cases 1, 3, and 4; I haven't figured out what to do to convert one to the other. Anyway, the only case that's really working is case 2. However, when I run it, I get this: Enter a Decimal number: 10 5 base 10 = 0 base 2 2 base 10 = 1 base 2 1 base 10 ... |
96. Need to convert a binary value into decimal forums.oracle.com |
97. converting from long to float or double keeping the numbers after decimal forums.oracle.com |
98. convert scientific number (like 6.25E-1) to decimal forums.oracle.com |
99. Decimal to binary conversion and vice versa forums.oracle.com |
100. convert decimal to binary forums.oracle.com |