GPS/Arduino to JAVA

Hello, I'm new in programation and I'm trying to make a GPS tracker that record the traveled route. To do this, i'm using the following code, based on the code obtained from "Arduino Playground - GPS".

The code is working and i'm obtaining the correct data from the GPS in the serial monitor, but when I try to send the latitude (for example) to a JAVA programm that save the data in excel (My java program is working for another sensors), instead of saving the latitud as: 2545.78516 for every read, in JAVA i'm obtaining "2", "5", "4", "5", "7", "8", "5", "1", "6" in every cell. I hope you can help to understand why this is happening, thanks.

My code:

#include <string.h>
#include <ctype.h>
int ledPin = 2; // Pin 2 LED (ON)
int ledPin2 = 3; // Pin 3 if is not reading data
int rxPin = 0; // rx Pin
int txPin = 1; // tx Pin
int byteGPS=-1;
char linea[300] = "";
char comandoGPR[7] = "$GPRMC";

int cont=0;
int bien=0;
int conta=0;
int indices[13];

int checksum=0;
char date=0; l
char time=0;
char lat =0 , lon=0 , vel=0 , track=0, heading=0;
char valor1 , valor2 , valor3 , valor4 , valor5;
/////////////////////////////////////////////////////////////////////////////////////////
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(ledPin2,OUTPUT);
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
Serial.begin(9600);

for (int i=0 ; i<300 ; i++) // Initialize a buffer for received data
{
linea_=' '; //Vector linea para almacenar mensaje de navegaciĆ³n_
* }*

}
/////////////////////////////////////////////////////////////////////////////////////////
void loop()
{
* byteGPS=Serial.read(); // Read a byte of the serial port*

* if (byteGPS == -1) // See if the serial port is empty*
* { *
* digitalWrite(ledPin2,HIGH); *
* }// Cierra if(byteGPS==-1)*
* else*
* { // Potential buffer overflow here*
* digitalWrite(ledPin, HIGH); *
* linea[conta] = byteGPS; // If there is serial port data, it is put in the buffer *
* conta++; *

* if (byteGPS==13) *
* { // NOTE: THE ACTUAL END OF TRANSMISION IS (i.e. 0x13 0x10)*
* cont=0;*
* bien=0;*

* for (int i=1;i<7;i++) // Verifies if the received command starts with $GPR*
* { *
_ if (linea*==comandoGPR[i-1])
{
bien++;
}// Cierra if(linea==comandoGPR[i-1]
}// Cierra for(int i=1;i<7;i++)
if(bien==6) // If yes, continue and process the data*

* {
for (int i=0;i<300;i++)
{
if (linea==',') // check for the position of the "," separator
{
indices[cont]=i;
cont++;
} //Cierra if(linea==',')
if (linea=='')

* {
indices[12]=i; // ... and the ""

* cont++;
}// Cierra if (linea=='')

* }// Cierra for(int i=0;i<300;i++)*_

* /////////////////////////////////////////////////////////////////////////////////////////*

* for (int i=0;i<12;i++)*
* {*
_ //switch(i){ **********************************************
// case 0 :Serial.print("Time in UTC (HhMmSs): ");break;
// case 1 :Serial.print("Status (A=OK,V=KO): ");break;
// case 2 :Serial.print("Latitude: ");break;
// case 3 :Serial.print("Direction (N/S): ");break;
// case 4 :Serial.print("Longitude: ");break;
// case 5 :Serial.print("Direction (E/W): ");break;
// case 6 :Serial.print("Velocity in knots: ");break;
// case 7 :Serial.print("Heading in degrees: ");break;
// case 8 :Serial.print("Date UTC (DdMmAa): ");break;
// case 9 :Serial.print("Magnetic degrees: ");break;
// case 10 :Serial.print("(E/W): ");break;
// case 11 :Serial.print("Mode: ");break;
// case 12 :Serial.print("Checksum: ");break;*

//}//Cierra Switch ****************************************_

_ for (int j=indices*;j<(indices[i+1]-1);j++)
{
switch(i){
case 0 : time=(linea[j+1]);
//Serial.print(linea[j+1]);break;
Serial.print(time);break;
case 1 : valor1=(linea[j+1]);
//Serial.print(linea[j+1]);break;
Serial.print(valor1);break;
case 2 : lat=(linea[j+1]);
//Serial.print(linea[j+1]);break;
Serial.print(lat);break;
case 3 : valor2=(linea[j+1]);
//Serial.print(linea[j+1]);break;
Serial.print(valor2);break;
case 4 : lon=(linea[j+1]);
//Serial.print(linea[j+1]);break;
Serial.print(lon);break;
case 5 : valor3=(linea[j+1]);
//Serial.print(linea[j+1]);break;
Serial.print(valor3);break;
case 6 : vel=(linea[j+1]);
//Serial.print(linea[j+1]);break;
Serial.print(vel);break;
case 7 : track=(linea[j+1]);
//Serial.print(linea[j+1]);break;
Serial.print(track);break;
case 8 : date=(linea[j+1]);
//Serial.print(linea[j+1]);break;
Serial.print(date);break;
case 9 : heading=(linea[j+1]);
//Serial.print(linea[j+1]);break;
Serial.print(heading);break;
case 10 : valor4=(linea[j+1]);
//Serial.print(linea[j+1]);break;
Serial.print(valor4);break;
case 11 : valor5=(linea[j+1]);
//Serial.print(linea[j+1]);break;
Serial.print(valor5);break;
case 12 : checksum=(linea[j+1]);
//Serial.print(linea[j+1]);break;
Serial.print(checksum);break;
}// Cierra Switch*

}// Cierra for(int j=indices*;j<(indices[i+1]-1);j++)
Serial.println("");
}// Cierra for (int i=0;i<12;i++)*_

/////////////////////////////////////////////////////////////////////////////////////////
* }// Cierra if(bien==6)*
* conta=0; // Reset buffer*
* for (int i=0;i<300;i++)*
* { *
_ linea*=' ';
}// Cierra for(int i=0;i<300;i++)*_

* }// Cierrra if(byteGPS==13)*
* }// Cierra else de "if (byteGPS==-1)*
* digitalWrite(ledPin,LOW);*
* digitalWrite(ledPin2,LOW);*
}// Cierra loop

What kind of Arduino do you use? How did you connect the GPS to the Arduino? What program are you using on the PC (link)?

Edit your post and insert code tags because your program the way it's displayed now (the forum system is interpreting some characters).

...hhhmmm... the code is not clear but I think the problem could be in Serial.println("") row. Do you print 12 values or a value with 12 digitis?

How Java side manage the end of message?