-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTest.java
More file actions
executable file
·62 lines (44 loc) · 1.19 KB
/
Copy pathTest.java
File metadata and controls
executable file
·62 lines (44 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
public class Test {
public static void main(String[] args) {
int Version = 2;
int Padding = 0;
int Extension = 0;
int CC = 3;
int Marker = 0;
int Ssrc = 0;
int SequenceNumber = 65532;
int TimeStamp = 16777217;
int PayloadType = 50;
byte[] header = new byte[12];
header[0] |= Version << (7-1);
header[0] |= Padding << (7-3);
header[0] |= Extension << (7-4);
header[0] |= CC << (7-7);
header[1] |= Marker << (7-0);
header[1] |= PayloadType << (7-7);
header[2] |= SequenceNumber >> 8;
header[3] |= SequenceNumber & 0xFF;
header[4] |= TimeStamp >> 24;
header[5] |= TimeStamp >> 16;
header[6] |= TimeStamp >> 8;
header[7] |= TimeStamp & 0xFF;
header[8] |= Ssrc >> 24;
header[9] |= Ssrc >> 16;
header[10] |= Ssrc >> 8;
header[11] |= Ssrc & 0xFF;
printheader(header);
}
public static void printheader(byte[] header) {
//TO DO: uncomment
for (int i=0; i < (12-4); i++)
{
for (int j = 7; j>=0 ; j--)
if (((1<<j) & header[i] ) != 0)
System.out.print("1");
else
System.out.print("0");
System.out.print(" ");
}
System.out.println();
}
}