You do need to handle the Loop packets as a byte array. It also helps to put it thru the CRC function before trying to parse it for data.
I don't do any Java programming but this may help.
It's the VB.net code that I was using for Add-InWx before moving to C#.
Sorry for the lack of comments, But it should be pretty straight forward. The "ProcessData" Subroutine takes the Station's "Loop" packet as a byte array then parses it.
The "CRC_Check" function will return a 0 if the packet is good, any other number returned signifies that the data packet was corrupted during transmission.
oh, the values in the CRC table are declared in HEX. VB.net doesn't like the "0x" prefix, but instead it takes the "&H".
Private Sub ProcessData(ByRef DataToProcess As Byte())
'Now Here's Where We start Pullling The Data values out of the recived data string
If DataToProcess.Count = 99 Then 'Check to see if the data string contains anything
Dim CRC_Val As UShort = CRC_Check(DataToProcess) ' Put the Byte array thru the CRC function
If CRC_Val = 0 Then
WXData.TempOutCur.Value = BitConverter.ToInt16(DataToProcess, 12) * 0.1 'Out Temp
WXData.TempOutCur.TimeOfValue = DateTime.Now
WXData.TempInCur.Value = BitConverter.ToInt16(DataToProcess, 9) * 0.1 'In Temp
WXData.TempInCur.TimeOfValue = DateTime.Now
WXData.WindSpeed.Value = Convert.ToInt32(DataToProcess(14)) 'Wind Speed
WXData.WindSpeed.TimeOfValue = DateTime.Now
WXData.WindBearing.Value = BitConverter.ToInt16(DataToProcess, 16) 'Wind Bearing
WXData.WindBearing.TimeOfValue = DateTime.Now
WXData.BarometerCur.Value = Decimal.Round(Convert.ToDecimal(BitConverter.ToInt16(DataToProcess, 7) / 1000), 2)
WXData.BarometerCur.TimeOfValue = DateTime.Now
WXData.RainTodayTotal.Value = BitConverter.ToInt16(DataToProcess, 50) * 0.01 'Today's Precip
WXData.RainTodayTotal.TimeOfValue = DateTime.Now
WXData.RainLongTermTotal.Value = BitConverter.ToInt16(DataToProcess, 54) * 0.01 'Total Precip This Year
WXData.RainLongTermTotal.TimeOfValue = DateTime.Now
WXData.HumidityOutCur.Value = Convert.ToInt32(DataToProcess(33)) 'OutHumidity
WXData.HumidityOutCur.TimeOfValue = DateTime.Now
If Convert.ToInt32(DataToProcess(43)) <> 255 Then
WXData.UVIndex.Value = Convert.ToInt32(DataToProcess(43)) * 0.1 'UV Index
WXData.UVIndex.TimeOfValue = DateTime.Now
End If
WXData.SolarRaidiation.Value = BitConverter.ToInt16(DataToProcess, 44) 'Solar Radiation
WXData.SolarRaidiation.TimeOfValue = DateTime.Now
WXData.LastUpdated = DateTime.Now
Status = "Updated"
Else
Status = "CRC Check failed"
End If
Else
Status = "Data Length Is Invalid."
End If
End Sub
Private Shared Function CRC_Check(ByRef Data_Array As Byte()) As UShort
Dim crc As UShort = 0
For Each Tempbyte As Byte In Data_Array
crc = CRC_Table((crc >> 8) Xor Tempbyte) Xor ((crc And &HFF) << 8)
Next
Return crc
End Function
Private Shared CRC_Table() As UShort = {&H0, &H1021, &H2042, &H3063, &H4084, &H50A5, &H60C6, &H70E7,
&H8108, &H9129, &HA14A, &HB16B, &HC18C, &HD1AD, &HE1CE, &HF1EF,
&H1231, &H210, &H3273, &H2252, &H52B5, &H4294, &H72F7, &H62D6,
&H9339, &H8318, &HB37B, &HA35A, &HD3BD, &HC39C, &HF3FF, &HE3DE,
&H2462, &H3443, &H420, &H1401, &H64E6, &H74C7, &H44A4, &H5485,
&HA56A, &HB54B, &H8528, &H9509, &HE5EE, &HF5CF, &HC5AC, &HD58D,
&H3653, &H2672, &H1611, &H630, &H76D7, &H66F6, &H5695, &H46B4,
&HB75B, &HA77A, &H9719, &H8738, &HF7DF, &HE7FE, &HD79D, &HC7BC,
&H48C4, &H58E5, &H6886, &H78A7, &H840, &H1861, &H2802, &H3823,
&HC9CC, &HD9ED, &HE98E, &HF9AF, &H8948, &H9969, &HA90A, &HB92B,
&H5AF5, &H4AD4, &H7AB7, &H6A96, &H1A71, &HA50, &H3A33, &H2A12,
&HDBFD, &HCBDC, &HFBBF, &HEB9E, &H9B79, &H8B58, &HBB3B, &HAB1A,
&H6CA6, &H7C87, &H4CE4, &H5CC5, &H2C22, &H3C03, &HC60, &H1C41,
&HEDAE, &HFD8F, &HCDEC, &HDDCD, &HAD2A, &HBD0B, &H8D68, &H9D49,
&H7E97, &H6EB6, &H5ED5, &H4EF4, &H3E13, &H2E32, &H1E51, &HE70,
&HFF9F, &HEFBE, &HDFDD, &HCFFC, &HBF1B, &HAF3A, &H9F59, &H8F78,
&H9188, &H81A9, &HB1CA, &HA1EB, &HD10C, &HC12D, &HF14E, &HE16F,
&H1080, &HA1, &H30C2, &H20E3, &H5004, &H4025, &H7046, &H6067,
&H83B9, &H9398, &HA3FB, &HB3DA, &HC33D, &HD31C, &HE37F, &HF35E,
&H2B1, &H1290, &H22F3, &H32D2, &H4235, &H5214, &H6277, &H7256,
&HB5EA, &HA5CB, &H95A8, &H8589, &HF56E, &HE54F, &HD52C, &HC50D,
&H34E2, &H24C3, &H14A0, &H481, &H7466, &H6447, &H5424, &H4405,
&HA7DB, &HB7FA, &H8799, &H97B8, &HE75F, &HF77E, &HC71D, &HD73C,
&H26D3, &H36F2, &H691, &H16B0, &H6657, &H7676, &H4615, &H5634,
&HD94C, &HC96D, &HF90E, &HE92F, &H99C8, &H89E9, &HB98A, &HA9AB,
&H5844, &H4865, &H7806, &H6827, &H18C0, &H8E1, &H3882, &H28A3,
&HCB7D, &HDB5C, &HEB3F, &HFB1E, &H8BF9, &H9BD8, &HABBB, &HBB9A,
&H4A75, &H5A54, &H6A37, &H7A16, &HAF1, &H1AD0, &H2AB3, &H3A92,
&HFD2E, &HED0F, &HDD6C, &HCD4D, &HBDAA, &HAD8B, &H9DE8, &H8DC9,
&H7C26, &H6C07, &H5C64, &H4C45, &H3CA2, &H2C83, &H1CE0, &HCC1,
&HEF1F, &HFF3E, &HCF5D, &HDF7C, &HAF9B, &HBFBA, &H8FD9, &H9FF8,
&H6E17, &H7E36, &H4E55, &H5E74, &H2E93, &H3EB2, &HED1, &H1EF0}