Clean up duplicate methods

Test: ./gradlew bluetooth:bluetooth-testing:check
Change-Id: I42a7c7e3d922092112b248fec2a7b7dbcd681070
diff --git a/bluetooth/bluetooth-testing/src/test/kotlin/androidx/bluetooth/testing/RobolectricGattClientTest.kt b/bluetooth/bluetooth-testing/src/test/kotlin/androidx/bluetooth/testing/RobolectricGattClientTest.kt
index 79560e5..7bab0cd 100644
--- a/bluetooth/bluetooth-testing/src/test/kotlin/androidx/bluetooth/testing/RobolectricGattClientTest.kt
+++ b/bluetooth/bluetooth-testing/src/test/kotlin/androidx/bluetooth/testing/RobolectricGattClientTest.kt
@@ -31,7 +31,6 @@
 import androidx.bluetooth.BluetoothDevice
 import androidx.bluetooth.BluetoothLe
 import androidx.bluetooth.GattClient
-import java.nio.ByteBuffer
 import java.util.UUID
 import java.util.concurrent.atomic.AtomicInteger
 import junit.framework.TestCase.fail
@@ -476,12 +475,4 @@
             )
         }
     }
-
-    private fun Int.toByteArray(): ByteArray {
-        return ByteBuffer.allocate(Int.SIZE_BYTES).putInt(this).array()
-    }
-
-    private fun ByteArray.toInt(): Int {
-        return ByteBuffer.wrap(this).int
-    }
 }
diff --git a/bluetooth/bluetooth-testing/src/test/kotlin/androidx/bluetooth/testing/RobolectricGattServerTest.kt b/bluetooth/bluetooth-testing/src/test/kotlin/androidx/bluetooth/testing/RobolectricGattServerTest.kt
index c7027b3..5c04c40 100644
--- a/bluetooth/bluetooth-testing/src/test/kotlin/androidx/bluetooth/testing/RobolectricGattServerTest.kt
+++ b/bluetooth/bluetooth-testing/src/test/kotlin/androidx/bluetooth/testing/RobolectricGattServerTest.kt
@@ -32,7 +32,6 @@
 import androidx.bluetooth.GattServer
 import androidx.bluetooth.GattServerRequest
 import androidx.bluetooth.GattService
-import java.nio.ByteBuffer
 import java.util.UUID
 import junit.framework.TestCase.fail
 import kotlinx.coroutines.CompletableDeferred
@@ -470,11 +469,3 @@
         }
     }
 }
-
-private fun Int.toByteArray(): ByteArray {
-    return ByteBuffer.allocate(Int.SIZE_BYTES).putInt(this).array()
-}
-
-private fun ByteArray.toInt(): Int {
-    return ByteBuffer.wrap(this).int
-}
diff --git a/bluetooth/bluetooth-testing/src/test/kotlin/androidx/bluetooth/testing/TestUtils.kt b/bluetooth/bluetooth-testing/src/test/kotlin/androidx/bluetooth/testing/TestUtils.kt
new file mode 100644
index 0000000..d3872cf
--- /dev/null
+++ b/bluetooth/bluetooth-testing/src/test/kotlin/androidx/bluetooth/testing/TestUtils.kt
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.bluetooth.testing
+
+import java.nio.ByteBuffer
+
+internal fun Int.toByteArray(): ByteArray {
+    return ByteBuffer.allocate(Int.SIZE_BYTES).putInt(this).array()
+}
+
+internal fun ByteArray.toInt(): Int {
+    return ByteBuffer.wrap(this).int
+}