Skip to main content

All Questions

Tagged with
-6 votes
2 answers
127 views

how to number value in convert in indian currency format. like (120000 to 1.2Lakh & 50000000 to 5Cr [closed]

Hello guys I want to convert my number value in short form but in indian value short form like 6500 to 6.5K 50000 to 50K 99900 to 99.9K 100000 to 1Lakh 150000 to 1.5Lakh 1000000 to 10Lakh 1450000 to ...
Abhi Plx's user avatar
2 votes
2 answers
89 views

NumberFormat.parse("3.14") returning 314 when used with German Locale

When I try to read the string "3.14" as a float using German Locale I expect one of two things to happen: (1) throw an error, because that is not a valid way to write 3.14 in German (2) ...
julaine's user avatar
  • 1,436
3 votes
3 answers
146 views

How to sort an ArrayList of type Number

/* Here is a method to sort an array list * if the array list type is Integer ect this runs just fine * But errors on Number */ public static void sort(ArrayList<Number> list){ ...
Diavel's user avatar
  • 57
0 votes
2 answers
118 views

Convert a decimal number in Java into its assumed decimal Cobol representation

I have a requirement to convert a regular number (most likely with 2 decimal digits) into its respective Cobol counterpart with so called assumed decimal point in the following format: 9(9)v99. I ...
Simeon Leyzerzon's user avatar
-2 votes
1 answer
98 views

how to use percentages in java [closed]

public class BankAccount{ public int number; private double balance; public boolean transfer(double amount){ /*transfer money between BankAccount taking into consideration that a ...
massomeamin's user avatar
0 votes
0 answers
96 views

java.lang.NumberFormatException With Arabic phone language

When the phone language is Arabic, I get an error on my app: java.lang.NumberFormatException: For input string: "٣٨.٦٣٤" When I try to capture the latitude and longitude of a user's ...
The Artist For Informatics's user avatar
0 votes
1 answer
141 views

How to convert string to integer when we have comma (,) in between word when used in java code [duplicate]

I am trying to convert a price amount 3,456 which is in string datatype to integer data type. But I'm getting a number format exception error. I have tried parseInt method and valueOf but giving same ...
srilatha's user avatar
1 vote
2 answers
171 views

Why is "1,2,3" parsed as 123 by Java's en-US DecimalFormat?

Parsing "1,2,3" using the en-US's decimal format results in the number 123. import java.text.*; import java.util.Locale; public class Main{ public static void main(String[] args) ...
bruno's user avatar
  • 2,253
3 votes
2 answers
65 views

Mortgage calculator, how to exclude letter and accept only numbers

we have this method System.out.print("Enter Principal Amount (1k to 1m) ") ; while (true) { principal = scanner.nextInt(); if (principal >= 1000 &&...
sartep's user avatar
  • 69
2 votes
1 answer
372 views

NumberFormat.getCurrencyInstance() formats to a string with whitespace, that is no whitespace. How to remove it?

I have the following code: NumberFormat numberFormat = NumberFormat.getCurrencyInstance(getLocale()); return numberFormat.format("-123.45").replaceAll("\\s", ""); Since ...
Sebastian's user avatar
  • 907
0 votes
1 answer
56 views

How can I set the value of a JFormatedTextField to an invalid String before it gets changed by the user?

Because of a project, I want to know how to set the value of a JFormatedTextField, in a Java Swing GUI, to an invalid String, before the user changes the value by himself/herself. Considering the fact ...
codenoob's user avatar
0 votes
1 answer
103 views

Formatting numbers with NumberFormat and BigDecimal.movePointRight()

I have to format values from a database to display this values in a frontend. The database values looks like this: 0.0009 and the output have to look like this 0,09. ($F{Param1} == null) ? ""...
Alan_P's user avatar
  • 1
0 votes
1 answer
76 views

NL locale returns ambiguous number

if I want to use different number formats across Europe to one format (double), it doesn't seem to work. Locale locale = new Locale("nl", "NL"); NumberFormat nf= NumberFormat....
jacob1989's user avatar
0 votes
0 answers
40 views

Formatting a Double to show only the first 2 decimals

I have a management software for invoices that creates a pdf document with the values inputed by the user in the various fields (product's price, quantity, reference etc.). I need to modify the code ...
Gianluca's user avatar
-1 votes
1 answer
169 views

Using Number formater java

I am try to use number formatter in java to formart intiger in to compact number fomart like 1000 to 1k but it give error My code package com.project.newproject; import java.text.NumberFormat; import ...
EmLeons's user avatar
  • 11

15 30 50 per page
1
2 3 4 5
38