Questions tagged as 'java'

2
answers

Checking time in java

Given a list with timetables eg: String [] schedules = {"11:00", "12:00", "13:00"}; I want to pick up my current time and compare it to the list next time, ie current time is 11:30 am, I get the "12:00" list.     
asked by 11.07.2015 / 07:54
1
answer

How to get the last 4 numbers of a variable?

I have to get last numbers from a variable and I do not know how to do it. I'm getting the milliseconds and I need to play this variable lol , where I need to return only the last 4 digits of lol not whole integer. package trabalh...
asked by 14.03.2015 / 18:36
2
answers

How to traverse the values of a HashMap through a given key?

How can I go through the values of a HashMap through a given key? An example to illustrate: I have a HashMap named values, with a key that is an id represented by String and a value that is an integer. HashMap<String, Integer> valores...
asked by 22.04.2015 / 21:58
1
answer

How to only send messages to other clients?

I have a question with java sockets. My code sends the messages to all clients, including what they send. I want it to send only to other customers. Can you do that? I test using the telnet 127.0.0.1 2015 command on the terminal. Custo...
asked by 23.09.2015 / 20:15
1
answer

Save file with extension

I would like to recover a file of type blob , and add the extension, without the user having to type this extension at the time of recovery. As it stands, I'm saving and also recovering, but recovering without the extension. I have the...
asked by 20.09.2015 / 21:17
2
answers

How to return strings that are in ascending date format in SQLite?

I've taken a long and recorded in the database with this format SimpleDateFormat("dd/MM/yyyy") which is a string and now I need to organize the dates. I tried to use this command but it comes in descending order ORDER BY date (data_c...
asked by 05.10.2015 / 17:14
1
answer

How to change page after inserting object in database?

I created a JSF page with a client form, after saving client by pressing the button register. The object persisted in the DB, and consequently I would like you to switch pages by going to index.xhtml or clearing the form fields to continu...
asked by 09.11.2014 / 20:36
1
answer

How to perform a date verification?

I would like to know how to check if a user-supplied input date is valid or not.     
asked by 08.11.2014 / 16:51
1
answer

How do I create a String model and whenever the user passes something different report the error?

I need a String template that starts with a letter, has no space, accepts numbers, is case sensitive, and does not accept special characters or accents, (it will be the name of a table in the database ) so I wanted something that would work as a...
asked by 10.11.2014 / 13:09
2
answers

Passing null parameter to a method

It is possible to pass / receive null parameters in Java. In C # I know it's possible using ? in type. public DateTime Teste(DateTime? exemplo){...} In this case the example I know can come null , in Java is this possible in...
asked by 05.11.2014 / 18:34