Questions tagged as 'java'

1
answer

How to improve this code

Some days ago I asked for help here in the OS to parse JSON in Java and I got what I wanted, however, I had to do a "gambiarra" for not knowing a better way. It's working, but I'm sure the code can be improved. My JSON is as follows: "we...
asked by 12.12.2017 / 03:05
2
answers

Error converting String to Double

Scenery: public void metodoX(Double valor) { DecimalFormat df = new DecimalFormat("0.00"); String valorRound = df.format(valor); Double valorRound2 = Double.parseDouble(valorRound); ... } Error: Caused by: java.lang.Numbe...
asked by 18.12.2017 / 16:56
1
answer

Change JTextField value from another class or automatically

I found some similar issues in the English version, but I could not resolve it. I have a Boiler class, with the following attributes: Boiler temperature; Water quantum; Fire temperature; In this program I will have to keep the boil...
asked by 14.08.2018 / 18:26
1
answer

Spring Model 4.3.1

I do not know how to work 100% with #POST and #GET yet, my problem should be in understanding how requests occur and when my objects are instantiated. Here are methods: CaixaOperacaoController.java @Controller @RequestMapping("/caixa") public...
asked by 07.08.2018 / 14:37
1
answer

How to make a grid with squares?

I would like to do something like this here, a Grid based on an array (and based on the value of the array, set a color to the corresponding cell), and I can manipulate it with the mouse.     
asked by 17.09.2017 / 15:39
1
answer

Encrypting and decoding passwords with character rotation

I have a database with a password field, which has a kind of "encryption". Analyzing the logic: I created users in the system and put the password: 123. When I went to check the password in the bank it was: 032. If we go for logical reason...
asked by 12.04.2015 / 04:49
1
answer

Recursive Algorithm

I have a job in college that I simply have no idea where to start. Show the recursive mathematical function that defines the mdc (maximum common divisor) between two natural. Based on it, do: 1. Define a recursive algorithm to compute mdc an...
asked by 09.04.2015 / 00:16
1
answer

Doubts with mask in JFormattedTextField

Working with JFormattedTextField , I got two problems that I could not find anything to help me solve. The example in this case would be JFormattedTextField for CPF. First problem: the mask. When I create the mask and run the pro...
asked by 14.08.2017 / 15:55
2
answers

How to transform an XML Object in the specified format?

I would like to generate XML for a request that I will make in Java from an object. The XML I want to generate is as follows: <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <v:Envelope xmlns:v="http://sc...
asked by 08.08.2017 / 20:53
1
answer

Get data in JSON

[ { "ID": 1, "ano": 5 } ] I do not know how I get in JSON the value of each of the fields, in this case "1" and "5", as I present above. In getting the data in JSON I tried to follow some tips that I have been looking for but in vain. I pre...
asked by 14.08.2017 / 13:02